Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
1f7af310
Commit
1f7af310
authored
Dec 27, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(configd/templates) solve issue when target pattern cannot be found in the config data
parent
c8589ad4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
template.py
src/opnsense/service/modules/template.py
+6
-2
No files found.
src/opnsense/service/modules/template.py
View file @
1f7af310
...
...
@@ -161,8 +161,10 @@ class Template(object):
else
:
target_keys
=
map
(
lambda
x
:
str
(
x
),
range
(
len
(
config_ptr
)))
else
:
# config pointer is reused when the match is exact, so we need to reset it here
# if the tag was not found.
config_ptr
=
None
break
if
len
(
target_keys
)
==
0
:
# single node, only used for string replacement in output name.
result
[
tag
]
=
{
tag
:
config_ptr
}
...
...
@@ -222,8 +224,10 @@ class Template(object):
for
target_filter
in
target_filters
.
keys
():
for
key
in
target_filters
[
target_filter
]
.
keys
():
for
filename
in
result_filenames
.
keys
():
if
filename
.
find
(
'[
%
s]'
%
target_filter
)
>
-
1
:
if
target_filters
[
target_filter
][
key
]
is
not
None
\
and
filename
.
find
(
'[
%
s]'
%
target_filter
)
>
-
1
:
new_filename
=
filename
.
replace
(
'[
%
s]'
%
target_filter
,
target_filters
[
target_filter
][
key
])
new_filename
=
new_filename
.
replace
(
'//'
,
'/'
)
result_filenames
[
new_filename
]
=
copy
.
deepcopy
(
result_filenames
[
filename
])
result_filenames
[
new_filename
][
key
]
=
target_filters
[
target_filter
][
key
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment