Skip to content

Commit ea4bc08

Browse files
authored
Merge pull request #142 from oracle/issue#140-standalone-validation-fails-with-tokens
Issue #140 - Check for token prefix before checking for relative paths
2 parents 9de88e0 + 57e84cc commit ea4bc08

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -922,9 +922,9 @@ def __validate_single_path_in_archive(self, path, attribute_name, model_folder_p
922922
self._logger.finest('tokens={0}', str(tokens), class_name=_class_name, method_name=_method_name)
923923
# TODO(mwooten) - This would be a good place to validate any path token found...
924924

925-
substituted_path = self._model_context.replace_token_string(path)
926-
if not os.path.isabs(substituted_path):
927-
validation_result.add_info('WLSDPLY-05031', attribute_name, model_folder_path, substituted_path)
925+
if not self._model_context.has_token_prefix(path):
926+
if not os.path.isabs(path):
927+
validation_result.add_info('WLSDPLY-05031', attribute_name, model_folder_path, path)
928928

929929
return validation_result
930930

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,18 @@ def replace_tokens_in_path(self, attribute_name, resource_dict):
425425
resource_dict[attribute_name] = result
426426
return
427427

428+
def has_token_prefix(self, path):
429+
"""
430+
Determines if the specified path begins with one of the known, portable token prefix paths.
431+
:param path: the path to check for token prefix
432+
:return: true if the path begins with a known prefix, false otherwise
433+
"""
434+
return path.startswith(self.__ORACLE_HOME_TOKEN) or \
435+
path.startswith(self.__WL_HOME_TOKEN) or \
436+
path.startswith(self.__DOMAIN_HOME_TOKEN) or \
437+
path.startswith(self.__CURRENT_DIRECTORY_TOKEN) or \
438+
path.startswith(self.__TEMP_DIRECTORY_TOKEN)
439+
428440
def replace_tokens(self, resource_type, resource_name, attribute_name, resource_dict):
429441
"""
430442
Replace the tokens in attribute value with the current value.

0 commit comments

Comments
 (0)