Skip to content

Commit 90686a4

Browse files
authored
Online update fix for JIRA 576 (#991)
* Fix some logic errors in online app deployment * fix error message * minor cleanup * Removed optimizing logic trying to determine shared library referenced apps and automate undeploy process for now. Add missing deploy commands output to the error message * minor update * update documentation and code comments * doc update * doc update * remove unused variable * Remove unused method
1 parent 71c7ab6 commit 90686a4

File tree

3 files changed

+51
-37
lines changed

3 files changed

+51
-37
lines changed

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

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def __online_deploy_apps_and_libs(self, base_location):
230230
# stop the app if the referenced shared library is newer or if the source path changes
231231
stop_app_list = list()
232232

233-
# applications and libraries (?) to be stopped and undeployed
233+
# applications to be stopped and undeployed
234234
stop_and_undeploy_app_list = list()
235235

236236
# libraries to be undeployed
@@ -240,27 +240,33 @@ def __online_deploy_apps_and_libs(self, base_location):
240240
# Go through the model libraries and find existing libraries that are referenced
241241
# by applications and compute a processing strategy for each library.
242242
self.__build_library_deploy_strategy(lib_location, model_shared_libraries, existing_lib_refs,
243-
stop_app_list, update_library_list, stop_and_undeploy_app_list)
243+
stop_app_list, update_library_list)
244+
244245

245246
# Go through the model applications and compute the processing strategy for each application.
246247
app_location = LocationContext(base_location).append_location(APPLICATION)
247248
self.__build_app_deploy_strategy(app_location, model_applications, existing_app_refs,
248249
stop_and_undeploy_app_list)
249250

250251
# deployed_app_list is list of apps that has been deployed and started again
251-
# redeploy_app_list is list of apps that needs to be redeployed
252252
deployed_app_list = []
253-
redeploy_app_list = []
254253

255-
# shared library updated, app referenced must be stopped, redeployed, and started so stop the app first
256-
for app in stop_app_list:
257-
self.__stop_app(app)
258-
# add the referenced app to the redeploy list
259-
redeploy_app_list.append(app)
260-
# add the referenced app to the start list
261-
deployed_app_list.append(app)
254+
# For in-place update of shared libraries (i.e. impl/spec versions are not updated in the MANIFEST.MF for
255+
# update), trying to do so will result in error just like the console.
256+
#
257+
# we will not automatically detect the referencing app and try to figure out the dependency graph and orders
258+
# for undeploying apps.
259+
#
260+
# 1. It needs to be fully undeploy shared library referenced apps
261+
# 2. But if the user only provides a sparse model for library update, the sparse model will not have the
262+
# original app and it will not be deployed again
263+
# 3. There maybe transitive references by shared library and it will be difficult to handle processing order
264+
# the full dependency graph
265+
# 4. Console will result in error and ask user to undeploy the app first, so we are not trying to add new
266+
# functionalities in wls.
267+
#
262268

263-
# app is updated, it must be stopped and undeployed first
269+
# user provide new versioned app, it must be stopped and undeployed first
264270
for app in stop_and_undeploy_app_list:
265271
self.__stop_app(app)
266272
self.__undeploy_app(app)
@@ -272,9 +278,6 @@ def __online_deploy_apps_and_libs(self, base_location):
272278
self.__deploy_model_libraries(model_shared_libraries, lib_location)
273279
self.__deploy_model_applications(model_applications, app_location, deployed_app_list)
274280

275-
for app in redeploy_app_list:
276-
self.__redeploy_app(app)
277-
278281
self.__start_all_apps(deployed_app_list, base_location)
279282
self.logger.exiting(class_name=self._class_name, method_name=_method_name)
280283
return
@@ -506,15 +509,14 @@ def __get_library_references(self, base_location):
506509
return existing_libraries
507510

508511
def __build_library_deploy_strategy(self, location, model_libs, existing_lib_refs, stop_app_list,
509-
update_library_list, stop_and_undeploy_app_list):
512+
update_library_list):
510513
"""
511514
Update maps and lists to control re-deployment processing.
512515
:param location: the location of the libraries
513516
:param model_libs: a copy of libraries from the model, attributes may be revised
514517
:param existing_lib_refs: map of information about each existing library
515518
:param stop_app_list: a list to update with dependent apps to be stopped and undeployed
516519
:param update_library_list: a list to update with libraries to be stopped before deploying
517-
:param stop_and_undeploy_app_list: a list to update with libraries to be stopped and undeployed
518520
"""
519521
_method_name = '__build_library_deploy_strategy'
520522

@@ -533,11 +535,9 @@ def __build_library_deploy_strategy(self, location, model_libs, existing_lib_ref
533535
lib_name = model_helper.get_delete_item_name(lib)
534536
if lib_name in existing_libs:
535537
model_libs.pop(lib)
536-
_add_ref_apps_to_stoplist(stop_app_list, existing_lib_refs, lib_name)
537-
stop_and_undeploy_app_list.append(lib_name)
538+
update_library_list.append(lib_name)
538539
else:
539540
model_libs.pop(lib)
540-
stop_and_undeploy_app_list.append(lib_name)
541541
continue
542542

543543
# determine the versioned name of the library from the library's MANIFEST
@@ -593,8 +593,8 @@ def __build_library_deploy_strategy(self, location, model_libs, existing_lib_ref
593593
if lib_dict['SourcePath'] is None and existing_src_path is not None:
594594
lib_dict['SourcePath'] = existing_src_path
595595

596-
_add_ref_apps_to_stoplist(stop_app_list, existing_lib_refs, versioned_name)
597-
update_library_list.append(versioned_name)
596+
if versioned_name not in update_library_list:
597+
update_library_list.append(versioned_name)
598598
else:
599599
# If the hashes match, assume that the library did not change so there is no need
600600
# to redeploy them ot the referencing applications unless the targets are different.
@@ -611,6 +611,7 @@ def __build_library_deploy_strategy(self, location, model_libs, existing_lib_ref
611611
lib_dict['SourcePath'] = existing_src_path
612612
return
613613

614+
614615
def __build_app_deploy_strategy(self, location, model_apps, existing_app_refs, stop_and_undeploy_app_list):
615616
"""
616617
Update maps and lists to control re-deployment processing.
@@ -697,13 +698,16 @@ def __build_app_deploy_strategy(self, location, model_apps, existing_app_refs, s
697698
else:
698699
self.logger.info('WLSDPLY-09336', src_path,
699700
class_name=self._class_name, method_name=_method_name)
700-
stop_and_undeploy_app_list.append(versioned_name)
701+
if versioned_name not in stop_and_undeploy_app_list:
702+
stop_and_undeploy_app_list.append(versioned_name)
701703
else:
702704
# updated deployment plan
703-
stop_and_undeploy_app_list.append(versioned_name)
705+
if versioned_name not in stop_and_undeploy_app_list:
706+
stop_and_undeploy_app_list.append(versioned_name)
704707
else:
705708
# updated app
706-
stop_and_undeploy_app_list.append(versioned_name)
709+
if versioned_name not in stop_and_undeploy_app_list:
710+
stop_and_undeploy_app_list.append(versioned_name)
707711
return
708712

709713
def __remove_delete_targets(self, model_dict, existing_ref):
@@ -834,7 +838,7 @@ def __handle_builtin_libraries(self, targets_not_changed, model_libs, lib,
834838
return
835839

836840
def __remove_app_from_deployment(self, model_dict, app_name):
837-
self.logger.info('WLSDPLY-09311', app_name,
841+
self.logger.info('WLSDPLY-09337', app_name,
838842
class_name=self._class_name, method_name='remove_app_from_deployment')
839843
model_dict.pop(app_name)
840844
return
@@ -889,14 +893,6 @@ def __undeploy_app(self, application_name, library_module='false', partition_nam
889893
targets=targets)
890894
return
891895

892-
def __redeploy_app(self, application_name):
893-
_method_name = '__redeploy_app'
894-
895-
self.logger.info('WLSDPLY-09315', application_name, class_name=self._class_name, method_name=_method_name)
896-
self.wlst_helper.redeploy_application(application_name,
897-
timeout=self.model_context.get_model_config().get_redeploy_timeout())
898-
return
899-
900896
def __deploy_model_libraries(self, model_libs, lib_location):
901897
if model_libs is not None and len(model_libs) > 0:
902898
uses_path_tokens_attribute_names = self.__get_uses_path_tokens_attribute_names(lib_location)
@@ -1200,17 +1196,18 @@ def _find_deployorder_list(apps_dict, ordered_list, order):
12001196
result.append(app_name)
12011197
return result
12021198

1203-
def _add_ref_apps_to_stoplist(stop_applist, lib_refs, lib_name):
1199+
def _add_ref_apps_to_stoplist(stop_and_undeploy_applist, lib_refs, lib_name):
12041200
"""
12051201
Add the referencing apps for the specified shared library to the stop list.
1206-
:param stop_applist: the stop list
1202+
:param stop_and_undeploy_applist: the stop list
12071203
:param lib_refs: the library references
12081204
:param lib_name: the library name
12091205
"""
12101206
if lib_refs[lib_name].has_key('referencingApp'):
12111207
apps = lib_refs[lib_name]['referencingApp'].keys()
12121208
for app in apps:
1213-
stop_applist.append(app)
1209+
if app not in stop_and_undeploy_applist:
1210+
stop_and_undeploy_applist.append(app)
12141211
return
12151212

12161213
def _update_ref_dictionary(ref_dictionary, lib_name, absolute_sourcepath, lib_hash, configured_targets,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,7 @@ WLSDPLY-09333=Library {0} not found. Please specify a valid library for deletion
11291129
WLSDPLY-09334=Application {0} not found. Please specify a valid application for deletion
11301130
WLSDPLY-09335=Undeploying {0} {1} from targets: {2}
11311131
WLSDPLY-09336=Redeployed application {0} because the old and the new binary have the same path.
1132+
WLSDPLY-09337=Removing {0} from model deployment because it is started with a delete notation. It will be undeployed.
11321133

11331134
# wlsdeploy/tool/deploy/common_resources_deployer.py
11341135
WLSDPLY-09400=ResourceGroup was specified in the test file but are not supported in WebLogic Server version {0}

documentation/2.0/content/userguide/tools/update.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@ When running the tool in WLST online mode, the update operation may require serv
3030
- `103` - The entire domain needs to be restarted.
3131
- `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.
3232

33+
### Online update for shared libraries
34+
35+
- When updating shared library online, it is recommended to deploy a new version of the library by updating the
36+
version(s) in the MANIFEST.MF file and update the deployment descriptor of any application that wants to upgrade to
37+
use the new library, this avoids complicated issues like in-place update of shared
38+
library.
39+
40+
- In-place update of shared library online is not supported - if you only
41+
update the library contents without updating the version(s) of the library in the MANIFEST.MF file. You will get an error
42+
from WebLogic Server indicating the library is referenced by applications and cannot be undeployed. You must undeploy
43+
all applications referencing the shared library first before proceeding; this is the same behavior when using the
44+
WebLogic Server console. Also, a shared library can potentially be referenced by another
45+
shared library module which in turns used by other applications, currently there is no capability within
46+
WebLogic Server to handle automating undeploy and deploy of an application that uses shared library when the library is
47+
updated in-place.
48+
3349
### Using an encrypted model
3450

3551
If the model or variables file contains passwords encrypted with the WDT Encryption tool, decrypt the passwords during create with the `-use_encryption` flag on the command line to tell the Update Domain Tool that encryption is being used and to prompt for the encryption passphrase. As with the database passwords, the tool can also read the passphrase from standard input (for example, `stdin`) to allow the tool to run without any user input. You can bypass the stdin prompt with two other options. Store the passphrase in an environment variable, and use the environment variable name with command-line option `-passphrase_env`. Another option is to create a file containing the passphrase value. Pass this filename with the command-line option `-passphrase_file`.

0 commit comments

Comments
 (0)