Handle nested brace inside variable
Change-Id: I1004ea869bfe56b380109c7bcae866931b4d4725
This commit is contained in:
parent
21f0506e65
commit
1a65a1d44b
@ -77,7 +77,7 @@ class CustomFormatter(Formatter):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
return super().vformat(format_string, args, kwargs)
|
return super().vformat(format_string, args, kwargs)
|
||||||
except (JenkinsJobsException, UndefinedError) as x:
|
except (JenkinsJobsException, UndefinedError, ValueError) as x:
|
||||||
if len(format_string) > 40:
|
if len(format_string) > 40:
|
||||||
short_fmt = format_string[:80] + "..."
|
short_fmt = format_string[:80] + "..."
|
||||||
else:
|
else:
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
nested_brace_in_variable.yaml:10:3: In project 'sample-project'
|
||||||
|
- project:
|
||||||
|
^
|
||||||
|
nested_brace_in_variable.yaml:5:3: In job template 'sample-job'
|
||||||
|
- job-template:
|
||||||
|
^
|
||||||
|
nested_brace_in_variable.yaml:8:15: While formatting string '{ {x} }': unexpected '{' in field name
|
||||||
|
- shell: '{ {x} }'
|
||||||
|
^
|
@ -0,0 +1,13 @@
|
|||||||
|
# Check braces inside variable does not cause parser to fail.
|
||||||
|
# This may happen when tag !include-raw: is used instead of !include-raw-escape:
|
||||||
|
# and there are nested blocks of groovy code inside included file.
|
||||||
|
|
||||||
|
- job-template:
|
||||||
|
name: sample-job
|
||||||
|
builders:
|
||||||
|
- shell: '{ {x} }'
|
||||||
|
|
||||||
|
- project:
|
||||||
|
name: sample-project
|
||||||
|
jobs:
|
||||||
|
- sample-job
|
Loading…
Reference in New Issue
Block a user