Skip to content

Commit 7e3d3d2

Browse files
authored
Issue #585 Improve error messsages for token syntax errors (#586)
1 parent 3e38451 commit 7e3d3d2

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,13 @@ def _process_node(nodes, variables, model_context):
209209
for member in value:
210210
if type(member) in [str, unicode]:
211211
index = value.index(member)
212-
value[index] = _substitute(member, variables, model_context)
212+
value[index] = _substitute(member, variables, model_context, key)
213213

214214
elif type(value) in [str, unicode]:
215-
nodes[key] = _substitute(value, variables, model_context)
215+
nodes[key] = _substitute(value, variables, model_context, key)
216216

217217

218-
def _substitute(text, variables, model_context):
218+
def _substitute(text, variables, model_context, attribute_name=None):
219219
"""
220220
Substitute token placeholders with their derived values.
221221
:param text: the text to process for token placeholders
@@ -287,7 +287,11 @@ def _substitute(text, variables, model_context):
287287
if token == "SECRET":
288288
sample += ":<key>"
289289
sample += "@@"
290-
_report_token_issue("WLSDPLY-01745", method_name, model_context, token, sample)
290+
291+
if attribute_name is None:
292+
_report_token_issue("WLSDPLY-01745", method_name, model_context, text, sample)
293+
else:
294+
_report_token_issue("WLSDPLY-01746", method_name, model_context, attribute_name, text, sample)
291295

292296
return text
293297

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ WLSDPLY-01740=Encryption failed: Unable to locate SerializedSystemIni
302302
WLSDPLY-01741=Encryption failed: Unable to initialize encryption service
303303

304304
# wlsdeploy/util/variables.py (cont'd)
305-
WLSDPLY-01745=Invalid syntax for token {0}, should be "{1}"
305+
WLSDPLY-01745=Invalid token syntax for name "{0}", should match "{1}"
306+
WLSDPLY-01746=Invalid token syntax for {0} value "{1}", should match "{2}"
306307

307308
# oracle.weblogic.deploy.util.WebLogicDeployToolingVersion.java (in src/main/resources/templates)
308309
WLSDPLY-01750=The WebLogic Deploy Tooling {0} version is {1}

0 commit comments

Comments
 (0)