included files override in wrong order
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
configglue |
Fix Committed
|
High
|
Unassigned |
Bug Description
When loading multiple files from the same location, the files are read in the incorrect order. For example, provided the following config file contents
$ cat local.cfg
[__main__]
includes =
a.cfg
b.cfg
c.cfg
$ cat a.cfg
[one]
foo = 1
$ cat b.cfg
[one]
foo = 2
$ cat c.cfg
[one]
foo = 3
The final parsed result will be such that
foo = 1
The reason for this is that the parser is not reset each time an included file is read so that all files get the same value for the 'includes' option causing configglue to read the included files ahead of time.
. Read local.cfg
. Parses includes line
. Read a.cfg
. Finds an include line with value: [a.cfg, b.cfg, c.cfg]
. Parses includes line
. Skips a.cfg (already read)
. Reads b.cfg
. Finds an include line with value: [a.cfg, b.cfg, c.cfg]
. Parses includes line
. Skips a.cfg (already read)
. Skips b.cfg (already read)
. Reads c.fg
. Finds an include line with value: [a.cfg, b.cfg, c.fg]
. Parses includes line
. Skips a.cfg (already read)
. Skips b.cfg (already read)
. Skips c.cfg (already read)
. Finishes parsing c.cfg
. Finishes parsing b.cfg
. Finishes parsing a.cfg
. Skips b.cfg (already read)
. Skips c.cfg (already read)
. Finishes parsing local.cfg
Related branches
- Ricardo Kirkner: Approve
- Natalia Bidart: Approve
-
Diff: 240 lines (+126/-30)2 files modifiedconfigglue/parser.py (+9/-1)
configglue/tests/test_parser.py (+117/-29)
Changed in configglue: | |
status: | New → In Progress |
Changed in configglue: | |
status: | In Progress → Fix Committed |