aboutsummaryrefslogtreecommitdiffstats
path: root/net/fill_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'net/fill_config.py')
-rwxr-xr-xnet/fill_config.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/net/fill_config.py b/net/fill_config.py
index 665926a..e97dab7 100755
--- a/net/fill_config.py
+++ b/net/fill_config.py
@@ -189,9 +189,12 @@ def insert_foreach(tmpl, tmpl_dir, tmpl_src, match, local_config, arg):
return ''.join(expanded)
def handle_commands(tmpl, tmpl_dir, tmpl_src, local_config):
- handled = 0
- for m in command_re.finditer(tmpl):
- handled += 1
+ while True:
+ # make sure to re-run the regex after each expansion to get proper string
+ # offsets each time
+ m = command_re.search(tmpl)
+ if not m:
+ break;
cmd = m.group(1)
arg = m.group(2)
if cmd == 'include':
@@ -202,6 +205,9 @@ def handle_commands(tmpl, tmpl_dir, tmpl_src, local_config):
print('Error: unknown command: %r in %r' % (cmd, tmpl_src))
exit(1)
+ # There was some command expansion. Go again.
+ continue
+
return tmpl
for tmpl_name in sorted(os.listdir(tmpl_dir)):