Skip to content

Commit 4fe43af

Browse files
committed
Merge branch 'app_lib_deploy_rewrite' into 'develop-4.0'
App, lib deploy rewrite See merge request weblogic-cloud/weblogic-deploy-tooling!1641
2 parents 49fcc20 + 8c36cab commit 4fe43af

File tree

32 files changed

+3277
-1650
lines changed

32 files changed

+3277
-1650
lines changed

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

Lines changed: 583 additions & 1352 deletions
Large diffs are not rendered by default.

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

Lines changed: 298 additions & 0 deletions
Large diffs are not rendered by default.

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

Lines changed: 1213 additions & 0 deletions
Large diffs are not rendered by default.

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

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -50,37 +50,38 @@ def get_library_versioned_name(self, source_path, model_name, from_archive=False
5050
:raises: DeployException: if an error occurs
5151
"""
5252
_method_name = 'get_library_versioned_name'
53-
5453
self.logger.entering(source_path, model_name, class_name=self._class_name, method_name=_method_name)
5554

56-
old_name_tuple = deployer_utils.get_library_name_components(model_name)
57-
try:
58-
versioned_name = old_name_tuple[self._EXTENSION_INDEX]
59-
manifest = self.__get_manifest(source_path, from_archive)
60-
if manifest is not None:
61-
attributes = manifest.getMainAttributes()
62-
63-
extension_name = attributes.getValue(EXTENSION_NAME)
64-
if not string_utils.is_empty(extension_name):
65-
versioned_name = extension_name
66-
67-
specification_version = attributes.getValue(SPECIFICATION_VERSION)
68-
if not string_utils.is_empty(specification_version):
69-
versioned_name += '#' + specification_version
70-
71-
# Cannot specify an impl version without a spec version
72-
implementation_version = attributes.getValue(IMPLEMENTATION_VERSION)
73-
if not string_utils.is_empty(implementation_version):
74-
versioned_name += '@' + implementation_version
75-
76-
self.logger.info('WLSDPLY-09324', model_name, versioned_name,
77-
class_name=self._class_name, method_name=_method_name)
78-
79-
except (IOException, FileNotFoundException, ZipException, IllegalStateException), e:
80-
ex = exception_helper.create_deploy_exception('WLSDPLY-09325', model_name, source_path,
81-
str_helper.to_string(e), error=e)
82-
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
83-
raise ex
55+
versioned_name = model_name
56+
if not string_utils.is_empty(model_name):
57+
old_name_tuple = deployer_utils.get_library_name_components(model_name)
58+
try:
59+
versioned_name = old_name_tuple[self._EXTENSION_INDEX]
60+
manifest = self.__get_manifest(source_path, from_archive)
61+
if manifest is not None:
62+
attributes = manifest.getMainAttributes()
63+
64+
extension_name = attributes.getValue(EXTENSION_NAME)
65+
if not string_utils.is_empty(extension_name):
66+
versioned_name = extension_name
67+
68+
specification_version = attributes.getValue(SPECIFICATION_VERSION)
69+
if not string_utils.is_empty(specification_version):
70+
versioned_name += '#' + specification_version
71+
72+
# Cannot specify an impl version without a spec version
73+
implementation_version = attributes.getValue(IMPLEMENTATION_VERSION)
74+
if not string_utils.is_empty(implementation_version):
75+
versioned_name += '@' + implementation_version
76+
77+
self.logger.info('WLSDPLY-09324', model_name, versioned_name,
78+
class_name=self._class_name, method_name=_method_name)
79+
80+
except (IOException, FileNotFoundException, ZipException, IllegalStateException), e:
81+
ex = exception_helper.create_deploy_exception('WLSDPLY-09325', model_name, source_path,
82+
str_helper.to_string(e), error=e)
83+
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
84+
raise ex
8485

8586
self.logger.exiting(class_name=self._class_name, method_name=_method_name, result=versioned_name)
8687
return versioned_name
@@ -98,32 +99,30 @@ def get_application_versioned_name(self, source_path, model_name, from_archive=F
9899
:raises: DeployException: if an error occurs
99100
"""
100101
_method_name = 'get_application_versioned_name'
101-
102102
self.logger.entering(source_path, model_name, class_name=self._class_name, method_name=_method_name)
103103

104104
# if no manifest version is found, leave the original name unchanged
105105
versioned_name = model_name
106-
if self.is_module_type_app_module(module_type):
107-
return model_name
108-
try:
109-
manifest = self.__get_manifest(source_path, from_archive)
110-
111-
if manifest is not None:
112-
attributes = manifest.getMainAttributes()
113-
application_version = attributes.getValue(self._APP_VERSION_MANIFEST_KEY)
114-
if application_version is not None:
115-
# replace any version information in the model name
116-
model_name_tuple = deployer_utils.get_library_name_components(model_name)
117-
versioned_name = model_name_tuple[self._EXTENSION_INDEX]
118-
versioned_name = versioned_name + '#' + application_version
119-
self.logger.info('WLSDPLY-09328', model_name, versioned_name, class_name=self._class_name,
120-
method_name=_method_name)
121-
122-
except (IOException, FileNotFoundException, ZipException, IllegalStateException), e:
123-
ex = exception_helper.create_deploy_exception('WLSDPLY-09329', model_name, source_path,
124-
str_helper.to_string(e), error=e)
125-
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
126-
raise ex
106+
if not self.is_module_type_app_module(module_type) and not string_utils.is_empty(source_path):
107+
try:
108+
manifest = self.__get_manifest(source_path, from_archive)
109+
110+
if manifest is not None:
111+
attributes = manifest.getMainAttributes()
112+
application_version = attributes.getValue(self._APP_VERSION_MANIFEST_KEY)
113+
if application_version is not None:
114+
# replace any version information in the model name
115+
model_name_tuple = deployer_utils.get_library_name_components(model_name)
116+
versioned_name = model_name_tuple[self._EXTENSION_INDEX]
117+
versioned_name = versioned_name + '#' + application_version
118+
self.logger.info('WLSDPLY-09328', model_name, versioned_name,
119+
class_name=self._class_name, method_name=_method_name)
120+
121+
except (IOException, FileNotFoundException, ZipException, IllegalStateException), e:
122+
ex = exception_helper.create_deploy_exception('WLSDPLY-09329', model_name, source_path,
123+
str_helper.to_string(e), error=e)
124+
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
125+
raise ex
127126

128127
self.logger.exiting(class_name=self._class_name, method_name=_method_name, result=versioned_name)
129128
return versioned_name

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
from wlsdeploy.exception import exception_helper
5151
from wlsdeploy.exception.exception_types import ExceptionType
5252
from wlsdeploy.logging import platform_logger
53+
from wlsdeploy.tool.deploy.applications_offline_deployer import OfflineApplicationsDeployer
54+
from wlsdeploy.tool.deploy.applications_online_deployer import OnlineApplicationsDeployer
5355
from wlsdeploy.tool.util import results_file
5456
from wlsdeploy.tool.util.string_output_stream import StringOutputStream
5557
from wlsdeploy.tool.util.wlst_helper import WlstHelper
@@ -66,6 +68,14 @@
6668
_wlst_helper = WlstHelper(ExceptionType.DEPLOY)
6769

6870

71+
def get_applications_deployer(model, model_context, aliases, wlst_mode=WlstModes.OFFLINE, location=LocationContext()):
72+
if wlst_mode == WlstModes.OFFLINE:
73+
app_deployer = OfflineApplicationsDeployer(model, model_context, aliases, base_location=location)
74+
else:
75+
app_deployer = OnlineApplicationsDeployer(model, model_context, aliases, base_location=location)
76+
return app_deployer
77+
78+
6979
def get_existing_object_list(location, aliases):
7080
"""
7181
Get a list of the existing names at the specified location.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from wlsdeploy.exception import exception_helper
1313
from wlsdeploy.logging.platform_logger import PlatformLogger
1414
from wlsdeploy.tool.deploy import deployer_utils
15-
from wlsdeploy.tool.deploy.applications_deployer import ApplicationsDeployer
1615
from wlsdeploy.tool.deploy.deployer import Deployer
1716
from wlsdeploy.tool.deploy.resources_deployer import ResourcesDeployer
1817

@@ -29,7 +28,8 @@ class ModelDeployer(Deployer):
2928
def __init__(self, model, model_context, aliases, wlst_mode=WlstModes.OFFLINE):
3029
Deployer.__init__(self, model, model_context, aliases, wlst_mode)
3130
self.resources_deployer = ResourcesDeployer(model, model_context, aliases, wlst_mode=wlst_mode)
32-
self.applications_deployer = ApplicationsDeployer(model, model_context, aliases, wlst_mode=wlst_mode)
31+
self.applications_deployer = \
32+
deployer_utils.get_applications_deployer(model, model_context, aliases, wlst_mode=wlst_mode)
3333

3434
def deploy_resources(self):
3535
"""

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from wlsdeploy.aliases.model_constants import RESOURCE_GROUP
1111
from wlsdeploy.aliases.model_constants import RESOURCE_GROUP_TEMPLATE
1212
from wlsdeploy.aliases.model_constants import RESOURCE_MANAGEMENT
13-
from wlsdeploy.tool.deploy.applications_deployer import ApplicationsDeployer
13+
from wlsdeploy.tool.deploy import deployer_utils
1414
from wlsdeploy.tool.deploy.coherence_resources_deployer import CoherenceResourcesDeployer
1515
from wlsdeploy.tool.deploy.common_resources_deployer import CommonResourcesDeployer
1616
from wlsdeploy.tool.deploy.datasource_deployer import DatasourceDeployer
@@ -121,8 +121,8 @@ def _add_resource_group_resources(self, parent_dict, location):
121121
coherence_deployer = CoherenceResourcesDeployer(self.model, self.model_context, self.aliases, self.wlst_mode)
122122
coherence_deployer.add_coherence_cluster_system_resources(parent_dict, location)
123123

124-
applications_deployer = \
125-
ApplicationsDeployer(self.model, self.model_context, self.aliases, self.wlst_mode, location)
124+
applications_deployer = deployer_utils.get_applications_deployer(self.model, self.model_context, self.aliases,
125+
self.wlst_mode, location)
126126
applications_deployer.deploy()
127127

128128
def _add_partition_work_managers(self, parent_dict, location):

core/src/main/python/wlsdeploy/tool/discover/deployments_discoverer.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ def get_applications(self):
226226
"""
227227
_method_name = 'get_applications'
228228
_logger.entering(class_name=_class_name, method_name=_method_name)
229+
229230
result = OrderedDict()
230231
model_top_folder_name = model_constants.APPLICATION
231232
location = LocationContext(self._base_location)
@@ -418,12 +419,10 @@ def _add_structured_application_to_archive(self, application_name, application_d
418419
else:
419420
_logger.info('WLSDPLY-06393', application_name, class_name=_class_name, method_name=_method_name)
420421

421-
422422
_logger.exiting(class_name=_class_name, method_name=_method_name)
423423

424424
def _is_structured_app(self, application_name, application_dict):
425425
_method_name = '_is_structured_app'
426-
427426
_logger.entering(application_dict, class_name=_class_name, method_name=_method_name)
428427

429428
source_path = None
@@ -437,29 +436,45 @@ def _is_structured_app(self, application_name, application_dict):
437436
if 'PlanPath' in application_dict:
438437
plan_path = application_dict['PlanPath']
439438

439+
_logger.finer('WLSDPLY-06405', application_name, source_path, plan_dir, plan_path,
440+
class_name=_class_name, method_name=_method_name)
441+
440442
if source_path is None:
441443
de = exception_helper.create_discover_exception('WLSDPLY-06404', application_name)
442444
_logger.throwing(class_name=_class_name, method_name=_method_name, error=de)
443445
raise de
444-
if plan_path is None or plan_dir is None:
446+
if plan_path is None:
445447
_logger.exiting(class_name=_class_name, method_name=_method_name, result=[False, None])
446448
return False, None
447449

448450
if self.path_helper.is_relative_path(source_path):
449451
source_path = self.path_helper.join(self._model_context.get_domain_home(), source_path)
450452
source_path = self.path_helper.get_canonical_path(source_path)
451-
if self.path_helper.is_relative_path(plan_dir):
452-
plan_dir = self.path_helper.join(self._model_context.get_domain_home(), plan_dir)
453-
plan_dir = self.path_helper.get_canonical_path(plan_dir)
454453

455454
source_path_parent = self.path_helper.get_parent_directory(source_path)
455+
_logger.finer('WLSDPLY-06406', application_name, source_path_parent,
456+
class_name=_class_name, method_name=_method_name)
456457
if source_path_parent is None or \
457458
self.path_helper.basename(source_path_parent) != 'app' or \
458459
self.path_helper.get_parent_directory(source_path_parent) == source_path_parent:
459460
_logger.exiting(class_name=_class_name, method_name=_method_name, result=[False, None])
460461
return False, None
461462

462-
install_root_dir = self._get_app_install_root(source_path_parent, plan_dir)
463+
# _get_app_install_root() only needs a path to either the PlanDir or the PlanPath to determine
464+
# if this application is a structured app.
465+
#
466+
if plan_dir is None:
467+
if self.path_helper.is_relative_path(plan_path):
468+
plan_path = self.path_helper.join(self._model_context.get_domain_home(), plan_path)
469+
plan_path = self.path_helper.get_canonical_path(plan_path)
470+
effective_plan = plan_path
471+
else:
472+
if self.path_helper.is_relative_path(plan_dir):
473+
plan_dir = self.path_helper.join(self._model_context.get_domain_home(), plan_dir)
474+
plan_dir = self.path_helper.get_canonical_path(plan_dir)
475+
effective_plan = plan_dir
476+
477+
install_root_dir = self._get_app_install_root(source_path_parent, effective_plan)
463478
if install_root_dir is not None:
464479
_logger.exiting(class_name=_class_name, method_name=_method_name,
465480
result=[True, install_root_dir])

core/src/main/python/wlsdeploy/tool/discover/discoverer.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,28 +119,35 @@ def _populate_model_parameters(self, dictionary, location):
119119
:return: dictionary of model attribute name and wlst value
120120
"""
121121
_method_name = '_populate_model_parameters'
122+
_logger.entering(dictionary, str_helper.to_string(location),
123+
class_name=_class_name, method_name=_method_name)
124+
122125
wlst_path = self._aliases.get_wlst_attributes_path(location)
123126
_logger.finer('WLSDPLY-06100', wlst_path, class_name=_class_name, method_name=_method_name)
124127

125128
if not self.wlst_cd(wlst_path, location):
129+
_logger.exiting(class_name=_class_name, method_name=_method_name, result=None)
126130
return
127131

128132
wlst_lsa_params = self._get_attributes_for_current_location(location)
129133
wlst_did_get = list()
130-
_logger.finest('WLSDPLY-06102', self._wlst_helper.get_pwd(), wlst_lsa_params, class_name=_class_name,
131-
method_name=_method_name)
134+
_logger.finest('WLSDPLY-06102', self._wlst_helper.get_pwd(), wlst_lsa_params,
135+
class_name=_class_name, method_name=_method_name)
132136
wlst_get_params = self._get_required_attributes(location)
133137
_logger.finest('WLSDPLY-06103', str_helper.to_string(location), wlst_get_params,
134138
class_name=_class_name, method_name=_method_name)
135139
if wlst_lsa_params is not None:
136140
for wlst_lsa_param in wlst_lsa_params:
137141
if wlst_lsa_param in wlst_get_params:
142+
_logger.finest('WLSDPLY-06132', wlst_lsa_param,
143+
class_name=_class_name, method_name=_method_name)
138144
success, wlst_value = self._get_attribute_value_with_get(wlst_lsa_param, wlst_path)
139145
wlst_did_get.append(wlst_lsa_param)
140146
if not success:
141147
continue
142148
else:
143-
_logger.finer('WLSDPLY-06131', wlst_lsa_param, class_name=_class_name, method_name=_method_name)
149+
_logger.finest('WLSDPLY-06131', wlst_lsa_param,
150+
class_name=_class_name, method_name=_method_name)
144151
wlst_value = wlst_lsa_params[wlst_lsa_param]
145152

146153
# if attribute was never set (online only), don't add to the model
@@ -160,10 +167,14 @@ def _populate_model_parameters(self, dictionary, location):
160167
# Find the attributes that are not in the LSA wlst map but are in the alias definitions with GET access
161168
get_attributes = [get_param for get_param in wlst_get_params if not get_param in wlst_did_get]
162169
for get_attribute in get_attributes:
170+
_logger.finest('WLSDPLY-06133', get_attribute,
171+
class_name=_class_name, method_name=_method_name)
163172
success, wlst_value = self._get_attribute_value_with_get(get_attribute, wlst_path)
164173
if success:
165174
self._add_to_dictionary(dictionary, location, get_attribute, wlst_value, wlst_path)
166175

176+
_logger.exiting(class_name=_class_name, method_name=_method_name)
177+
167178
def _omit_from_model(self, location, wlst_lsa_param):
168179
"""
169180
Determine if the specified attribute should be omitted from the model.

core/src/main/python/wlsdeploy/tool/validate/validator.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,8 +783,8 @@ def __validate_path_tokens_attribute(self, attribute_name, attribute_value, mode
783783
self._logger.finest('value_data_type={0}', value_data_type,
784784
class_name=_class_name, method_name=_method_name)
785785

786-
valid_valus_data_types = ['list', 'string', 'unicode']
787-
if value_data_type not in valid_valus_data_types:
786+
valid_value_data_types = ['list', 'string', 'unicode']
787+
if value_data_type not in valid_value_data_types:
788788
self._logger.severe('WLSDPLY-05023', attribute_name, model_folder_path, value_data_type,
789789
class_name=_class_name, method_name=_method_name)
790790
else:
@@ -803,6 +803,8 @@ def __validate_path_tokens_attribute(self, attribute_name, attribute_value, mode
803803
for item_path in attr_values:
804804
self.__validate_single_path_in_archive(item_path.strip(), attribute_name, model_folder_path)
805805

806+
self._logger.exiting(class_name=_class_name, method_name=_method_name)
807+
806808
def __validate_single_path_in_archive(self, path, attribute_name, model_folder_path):
807809
_method_name = '__validate_single_path_in_archive'
808810

0 commit comments

Comments
 (0)