Skip to content

Commit f234005

Browse files
committed
Merge branch 'jira-wdt-897-lax-archive-validation' into 'main'
Avoid lax validation failures when files are missing from archive or no archive is specified See merge request weblogic-cloud/weblogic-deploy-tooling!1706
2 parents 0c30f97 + 6a78494 commit f234005

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

core/src/main/python/wlsdeploy/tool/create/wlspolicies_helper.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import os
66
import re
77

8+
from oracle.weblogic.deploy.util import WLSDeployArchive
9+
810
from wlsdeploy.aliases.model_constants import POLICY
911
from wlsdeploy.aliases.model_constants import RESOURCE_ID
1012
from wlsdeploy.aliases.model_constants import WLS_POLICIES
@@ -99,12 +101,19 @@ def __validate_policy_object_fields_present(self, policy_name, policy_dict):
99101
pass
100102
elif isinstance(xacml_document, (str, unicode)) and not string_utils.is_empty(xacml_document):
101103
# validate xacml_document
102-
if self._archive_helper is not None and \
103-
self._archive_helper.is_path_into_archive(xacml_document) and \
104-
not self._archive_helper.contains_file(xacml_document):
105-
self._logger.severe('WLSDPLY-12601', policy_name, XACML_DOCUMENT, xacml_document,
106-
class_name=self.__class_name, method_name=_method_name)
107-
is_valid = False
104+
if WLSDeployArchive.isPathIntoArchive(xacml_document) and \
105+
(self._archive_helper is None or not self._archive_helper.contains_file(xacml_document)):
106+
107+
# log level depends on validate configuration
108+
validate_configuration = self._model_context.get_validate_configuration()
109+
if validate_configuration.allow_unresolved_archive_references():
110+
log_method = self._logger.info
111+
else:
112+
log_method = self._logger.severe
113+
is_valid = False
114+
115+
log_method('WLSDPLY-12601', policy_name, XACML_DOCUMENT, xacml_document,
116+
class_name=self.__class_name, method_name=_method_name)
108117
else:
109118
self._logger.severe('WLSDPLY-12603', policy_name, POLICY, XACML_DOCUMENT,
110119
class_name=self.__class_name, method_name=_method_name)

core/src/main/python/wlsdeploy/tool/create/wlsroles_helper.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from oracle.weblogic.deploy.json import JsonException
99
from oracle.weblogic.deploy.json import JsonStreamTranslator
1010
from oracle.weblogic.deploy.util import FileUtils
11+
from oracle.weblogic.deploy.util import WLSDeployArchive
1112

1213
from wlsdeploy.aliases.model_constants import APPEND
1314
from wlsdeploy.aliases.model_constants import EXPRESSION
@@ -110,10 +111,15 @@ def validate_roles(self):
110111
self.logger.severe('WLSDPLY-12502', role_name, UPDATE_MODE, role_update_mode,
111112
class_name=self.__class_name, method_name=_method_name)
112113
elif not string_utils.is_empty(xacml_document):
113-
if self._archive_helper is not None and \
114-
self._archive_helper.is_path_into_archive(xacml_document) and \
115-
not self._archive_helper.contains_file(xacml_document):
116-
self.logger.severe('WLSDPLY-12503', role_name, xacml_document,
114+
if WLSDeployArchive.isPathIntoArchive(xacml_document) and \
115+
(self._archive_helper is None or not self._archive_helper.contains_file(xacml_document)):
116+
validate_configuration = self._model_context.get_validate_configuration()
117+
if validate_configuration.allow_unresolved_archive_references():
118+
log_method = self.logger.info
119+
else:
120+
log_method = self.logger.severe
121+
122+
log_method('WLSDPLY-12503', role_name, xacml_document,
117123
class_name=self.__class_name, method_name=_method_name)
118124
else:
119125
self.logger.severe('WLSDPLY-12504', role_name, EXPRESSION, XACML_DOCUMENT,

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,19 @@ def __validate_store_property(self, store_property, type_property, pwd_property,
197197
tns_admin = dictionary_utils.get_element(rcu_info_dict, DRIVER_PARAMS_NET_TNS_ADMIN)
198198
qualified_path = rcudbinfo_helper.get_qualified_store_path(tns_admin, store_value)
199199
if WLSDeployArchive.isPathIntoArchive(qualified_path):
200+
# log level depends on validate configuration
201+
validate_configuration = self._model_context.get_validate_configuration()
202+
if validate_configuration.allow_unresolved_archive_references():
203+
log_method = self._logger.info
204+
else:
205+
log_method = self._logger.severe
206+
200207
if not self._archive_helper:
201-
self._logger.severe('WLSDPLY-05311', qualified_path, RCU_DB_INFO, store_property,
202-
class_name=self._class_name, method_name=_method_name)
208+
log_method('WLSDPLY-05311', qualified_path, RCU_DB_INFO, store_property,
209+
class_name=self._class_name, method_name=_method_name)
203210
elif not self.__is_path_in_archive_wallet(qualified_path):
204-
self._logger.severe('WLSDPLY-05312', qualified_path, RCU_DB_INFO, store_property,
205-
class_name=self._class_name, method_name=_method_name)
211+
log_method('WLSDPLY-05312', qualified_path, RCU_DB_INFO, store_property,
212+
class_name=self._class_name, method_name=_method_name)
206213

207214
def __has_tns_path(self, rcu_info_dict):
208215
"""

0 commit comments

Comments
 (0)