From ce8e671584aa2aff01715ace292faafce4b58983 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 27 Oct 2021 15:47:52 -0400 Subject: [PATCH] Have includes interpret section names If a syncfiles, then be sure to honor MERGE/APPENDONCE in those files without perturbing flow of the parent file. --- confluent_server/confluent/syncfiles.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/confluent_server/confluent/syncfiles.py b/confluent_server/confluent/syncfiles.py index 6477462f..f2071fa2 100644 --- a/confluent_server/confluent/syncfiles.py +++ b/confluent_server/confluent/syncfiles.py @@ -33,6 +33,7 @@ def mkdirp(path): raise def get_entries(filename): + secname = 'REPLACE:' filename = filename.strip() if filename[-1] == '>': filename = filename[:-1] @@ -43,9 +44,12 @@ def get_entries(filename): ent = ent.split('#', 1)[0].strip() if not ent: continue + if ent in ('APPENDONCE:', 'MERGE:', 'REPLACE:'): + secname = ent if ent[0] == '<': for subent in get_entries(ent[1:]): yield subent + yield secname else: yield ent @@ -77,6 +81,8 @@ class SyncList(object): currmap = self.mergemap elif ent == 'APPENDONCE:': currmap = self.appendoncemap + elif ent == 'REPLACE:': + currmap = self.replacemap else: raise Exception( 'Section "{}" is not currently supported in syncfiles'.format(ent[:-1]))