lago-project / lago

Ad-hoc virtual testing environment framework
http://lago.readthedocs.org
GNU General Public License v2.0
47 stars 39 forks source link

Ensure LagoInitFile is loaded by a consistent order #472

Open nvgoldin opened 7 years ago

nvgoldin commented 7 years ago

We use PyYAML which does not ensure any consistent order when loading the file. The natural thing is to use OrderedDict instead. Existing PR: https://github.com/lago-project/lago/pull/346, fails on something that looks like a bug when using both the yaml merge operator and a custom loader which ensures OrderedDict is used.

Recently, I was playing with anymarkup, a python library which also loads YAMLs as OrderedDict, one option is to check if it happens there too, and if not see what we are missing to make it work.

Some inspiration: http://stackoverflow.com/questions/38110900/constructorerror-with-yaml-load-while-using-ordereddict-that-support-auto-vivifi http://stackoverflow.com/questions/5121931/in-python-how-can-you-load-yaml-mappings-as-ordereddicts

gbenhaim commented 7 years ago

Why don't just put the domains \ nets in a list ?

ifireball commented 7 years ago

Hmm... that is what JJB and Ansible do... but doing that is a backwards-compatible way may be messy...