Skip to content

Commit 861c253

Browse files
Write rollback changed information to rollback.file (#773)
* Write rollback changed information to rollback.file * Rename exiting CLA argument rollback_if_require_restart to rollback_if_restart_required * JIRA WDT-501 - Name change in system test
1 parent 6abeef0 commit 861c253

File tree

15 files changed

+68
-22
lines changed

15 files changed

+68
-22
lines changed

core/src/main/python/deploy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ def __deploy_online(model, model_context, aliases):
154154
__wlst_helper.silence()
155155
if model_context.is_rollback_if_restart_required() and restart_required:
156156
__wlst_helper.cancel_edit()
157-
__logger.severe('WLSDPLY_09015', is_restartreq_output)
157+
__logger.warning('WLSDPLY_09015', is_restartreq_output)
158158
exit_code = CommandLineArgUtil.PROG_ROLLBACK_IF_RESTART_EXIT_CODE
159+
deployer_utils.list_rollback_changes(model_context, is_restartreq_output)
159160
else:
160161
__wlst_helper.save()
161162
__wlst_helper.activate(model_context.get_model_config().get_activate_timeout())

core/src/main/python/update.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,9 @@ def __check_update_require_domain_restart(model_context):
192192
__wlst_helper.silence()
193193
if model_context.is_rollback_if_restart_required() and restart_required:
194194
__wlst_helper.cancel_edit()
195-
__logger.severe('WLSDPLY_09015', is_restartreq_output)
195+
__logger.warning('WLSDPLY_09015', is_restartreq_output)
196196
exit_code = CommandLineArgUtil.PROG_ROLLBACK_IF_RESTART_EXIT_CODE
197+
deployer_utils.list_rollback_changes(model_context, is_restartreq_output)
197198
else:
198199
__wlst_helper.save()
199200
__wlst_helper.activate(model_context.get_model_config().get_activate_timeout())

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,22 @@ def list_restarts(model_context, exit_code):
480480
return result
481481

482482

483+
def list_rollback_changes(model_context, rollback_string):
484+
"""
485+
If output dir is present in the model context, write the restart data to the output dir as rollback.file.
486+
:param model_context: Current context with the run parameters.
487+
:param rollback_string: java.lang.String of changes that were rolled back
488+
"""
489+
_method_name = 'list_rollback_changes'
490+
_logger.entering(class_name=_class_name, method_name=_method_name)
491+
output_dir = model_context.get_output_dir()
492+
if len(str(rollback_string)) > 0 and output_dir is not None:
493+
file_name = os.path.join(output_dir, 'rollback.file')
494+
pw = FileUtils.getPrintWriter(file_name)
495+
pw.println(rollback_string)
496+
pw.close()
497+
498+
483499
def get_list_of_restarts():
484500
"""
485501
Return the restart checklist from the online domain instance. Log each instance of the restart checklist
@@ -501,7 +517,7 @@ def get_list_of_restarts():
501517
prt_cluster = cluster_name
502518
if cluster_name == '':
503519
prt_cluster = 'standalone'
504-
for resource in server.getPendingRestartSystemResources():
520+
for resource in resources:
505521
line = list()
506522
line.append(cluster_name)
507523
line.append(server_name)

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,30 @@ def get_pwd(self):
13901390
self.__logger.finest('WLSDPLY-00035', path, class_name=self.__class_name, method_name=_method_name)
13911391
return path
13921392

1393+
def get_object_name_name(self, object_name):
1394+
"""
1395+
Get the object name from the ObjectName instance using javax.management.ObjectName methods.
1396+
:param object_name: ObjectName instance
1397+
:return: ObjectName name value
1398+
"""
1399+
_method_name = 'get_object_name_name'
1400+
self.__logger.entering(object_name, class_name=self.__class_name, method_name=_method_name)
1401+
name = object_name.getKeyProperty('Name')
1402+
self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, resul=name)
1403+
return name
1404+
1405+
def get_object_name_type(self, object_name):
1406+
"""
1407+
Get the type of the object from the ObjectName instance using javax.management.ObjectName methods.
1408+
:param object_name: ObjectName instance
1409+
:return: ObjectName Type value
1410+
"""
1411+
_method_name = 'get_object_name_name'
1412+
self.__logger.entering(object_name, class_name=self.__class_name, method_name=_method_name)
1413+
name_type = object_name.getKeyProperty('Type')
1414+
self.__logger.exiting(class_name=self.__class_name, method_name=_method_name, resul=name)
1415+
return name_type
1416+
13931417
def silence(self):
13941418
"""
13951419
Silence the STDOUT chatter from WLST.

core/src/main/python/wlsdeploy/util/cla_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class CommandLineArgUtil(object):
6464
ENCRYPT_MANUAL_SWITCH = '-manual'
6565
# phony arg used as a key to store the password
6666
ONE_PASS_SWITCH = '-password'
67-
ROLLBACK_IF_RESTART_REQ_SWITCH = '-rollback_if_require_restart'
67+
ROLLBACK_IF_RESTART_REQ_SWITCH = '-rollback_if_restart_required'
6868
USE_ENCRYPTION_SWITCH = '-use_encryption'
6969
RUN_RCU_SWITCH = '-run_rcu'
7070
TARGET_VERSION_SWITCH = '-target_version'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ WLSDPLY-09012=While handling an error, failed to stop the current edit session a
10071007
WLSDPLY-09013=While handling an error, failed to close the domain: {0}
10081008
WLSDPLY-09014={0} was unable to load the model from {1} due to a translation error: {2}
10091009
WLSDPLY-09015={0} deployment failed: {1}
1010-
WLSDPLY_09015=Online update has been rollback because the flag rollback_if_require_restart is set and the update requires \
1010+
WLSDPLY_09015=Online update has been rollback because the flag rollback_if_restart_required is set and the update requires \
10111011
restart: {0}
10121012
WLSDPLY-09016=There are outstanding changes but -discard_current_edit has been specified, all changes have been \
10131013
discarded before processing update.

installer/src/main/bin/deployApps.cmd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ ECHO [-model_file ^<model_file^>]
7777
ECHO [-variable_file ^<variable_file^>]
7878
ECHO [-domain_type ^<domain_type^>]
7979
ECHO [-wlst_path ^<wlst_path^>]
80-
ECHO [-rollback_if_require_restart]
80+
ECHO [-rollback_if_restart_required]
8181
ECHO [-discard_current_edit]
8282
ECHO [-output_dir]
8383
ECHO [-admin_url ^<admin_url^>
@@ -115,11 +115,12 @@ ECHO admin_url - the admin server URL (used for online deploy)
115115
ECHO.
116116
ECHO admin_user - the admin username (used for online deploy)
117117
ECHO.
118-
ECHO rollback_if_require_restart - rollback the changes if the update requires domain restart
118+
ECHO rollback_if_restart_required - rollback the changes if the update requires domain restart
119119
ECHO.
120120
ECHO discard_current_edit - discard all existing changes before starting update
121121
ECHO.
122-
ECHO output_dir - if present, write restart information to this directory as restart.file
122+
ECHO output_dir - if present, write restart information to this directory as restart.file, or,
123+
ECHO if rollback_if_restart_required used, write rollback information to rollback.file
123124
ECHO.
124125
ECHO The -use_encryption switch tells the program that one or more of the
125126
ECHO passwords in the model or variables files are encrypted. The program will

installer/src/main/bin/deployApps.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ usage() {
3838
echo " [-variable_file <variable_file>]"
3939
echo " [-domain_type <domain_type>]"
4040
echo " [-wlst_path <wlst_path>]"
41-
echo " [-rollback_if_require_restart]"
41+
echo " [-rollback_if_restart_required]"
4242
echo " [-discard_current_edit]"
4343
echo " [-output_dir]"
4444
echo " [-admin_url <admin_url>"
@@ -76,11 +76,12 @@ usage() {
7676
echo ""
7777
echo " admin_user - the admin username (used for online deploy)"
7878
echo ""
79-
echo " rollback_if_require_restart - rollback the changes if the update requires domain restart"
79+
echo " rollback_if_restart_required - rollback the changes if the update requires domain restart"
8080
echo ""
8181
echo " discard_current_edit - discard all existing changes before starting update"
8282
echo ""
83-
echo " output_dir - if present, write restart information to this directory in restart.file"
83+
echo " output_dir - if present, write restart information to this directory in restart.file, or,"
84+
echo " if rollback_if_restart_required used, write rollback information to rollback.file"
8485
echo ""
8586
echo " The -use_encryption switch tells the program that one or more of the"
8687
echo " passwords in the model or variables files are encrypted. The program will"

installer/src/main/bin/shared.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ GOTO :EOF
351351

352352
IF "%RETURN_CODE%" == "104" (
353353
ECHO.
354-
ECHO %SCRIPT_NAME% completed successfully but the domain changes have been rolled back because -rollback_if_require_restart is specified ^(exit code = %RETURN_CODE%^)
354+
ECHO %SCRIPT_NAME% completed successfully but the domain changes have been rolled back because -rollback_if_restart_required is specified ^(exit code = %RETURN_CODE%^)
355355
EXIT /B %RETURN_CODE%
356356
)
357357
IF "%RETURN_CODE%" == "103" (

installer/src/main/bin/shared.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ checkExitCode() {
305305

306306
if [ $returnCode -eq 104 ]; then
307307
echo ""
308-
echo "$scriptName completed successfully but the domain changes have been rolled back because -rollback_if_require_restart is specified (exit code = ${RETURN_CODE})"
308+
echo "$scriptName completed successfully but the domain changes have been rolled back because -rollback_if_restart_required is specified (exit code = ${RETURN_CODE})"
309309
elif [ $returnCode -eq 103 ]; then
310310
echo ""
311311
echo "$scriptName completed successfully but the domain requires a restart for the changes to take effect (exit code = ${RETURN_CODE})"

installer/src/main/bin/updateDomain.cmd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ ECHO [-model_file ^<model_file^>]
7777
ECHO [-variable_file ^<variable_file^>]
7878
ECHO [-domain_type ^<domain_type^>]
7979
ECHO [-wlst_path ^<wlst_path^>]
80-
ECHO [-rollback_if_require_restart]
80+
ECHO [-rollback_if_restart_required]
8181
ECHO [-discard_current_edit]
8282
ECHO [-output_dir]
8383
ECHO [-admin_url ^<admin_url^>
@@ -115,11 +115,12 @@ ECHO admin_url - the admin server URL (used for online deploy)
115115
ECHO.
116116
ECHO admin_user - the admin username (used for online deploy)
117117
ECHO.
118-
ECHO rollback_if_require_restart - rollback the changes if the update requires domain restart
118+
ECHO rollback_if_restart_required - rollback the changes if the update requires domain restart
119119
ECHO.
120120
ECHO discard_current_edit - discard all existing changes before starting update
121121
ECHO.
122-
ECHO output_dir - if present, write restart information to this directory as restart.file
122+
ECHO output_dir - if present, write restart information to this directory as restart.file, or
123+
ECHO if rollback_if_restart_required used, write rollback information to rollback.file
123124
ECHO.
124125
ECHO The -use_encryption switch tells the program that one or more of the
125126
ECHO passwords in the model or variables files are encrypted. The program will

installer/src/main/bin/updateDomain.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ usage() {
3838
echo " [-variable_file <variable_file>]"
3939
echo " [-domain_type <domain_type>]"
4040
echo " [-wlst_path <wlst_path>]"
41-
echo " [-rollback_if_require_restart]"
41+
echo " [-rollback_if_restart_required]"
4242
echo " [-discard_current_edit]"
4343
echo " [-output_dir]"
4444
echo " [-admin_url <admin_url>"
@@ -76,11 +76,12 @@ usage() {
7676
echo ""
7777
echo " admin_user - the admin username (used for online deploy)"
7878
echo ""
79-
echo " rollback_if_require_restart - rollback the changes if the update requires domain restart"
79+
echo " rollback_if_restart_required - rollback the changes if the update requires domain restart"
8080
echo ""
8181
echo " discard_current_edit - discard all existing changes before starting update"
8282
echo ""
83-
echo " output_dir - if present, write restart information to this directory in restart.file"
83+
echo " output_dir - if present, write restart information to this directory in restart.file, or,"
84+
echo " if rollback_if_restart_required used, write rollback information to rollback.file"
8485
echo ""
8586
echo " The -use_encryption switch tells the program that one or more of the"
8687
echo " passwords in the model or variables files are encrypted. The program will"

site/deploy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ As usual, the tool will prompt for the password (it can also be supplied by pipi
2626
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:
2727

2828
- `103` - The entire domain needs to be restarted.
29-
- `104` - The domain changes have been rolled back because the changes in the model requires a domain restart and -rollback_if_require_restart is specified.
29+
- `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.
3030

3131
### Using an Encrypted Model
3232

site/update.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The Update Domain Tool will not attempt to recreate or add schemas for the RCU d
2121
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:
2222

2323
- `103` - The entire domain needs to be restarted.
24-
- `104` - The domain changes have been rolled back because the changes in the model requires a domain restart and -rollback_if_require_restart is specified.
24+
- `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.
2525

2626
### Using an Encrypted Model
2727

system-test/src/test/java/oracle/weblogic/deploy/integration/ITWdt.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ public void testDOnlineUpdate2() throws Exception {
450450

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

0 commit comments

Comments
 (0)