xmlbuilder: Order child props before serializing

We were implicitly depending on dict hash ordering here, which
was causing some different XML output in centos CI
This commit is contained in:
Cole Robinson 2018-02-20 11:41:04 -05:00
parent a8fb49dbe0
commit 059fb7d0ba
2 changed files with 3 additions and 3 deletions

View File

@ -91,6 +91,7 @@
<feature policy="disable" name="distest"/>
<feature policy="forbid" name="foo"/>
<feature policy="forbid" name="bar"/>
<cache mode="emulate" level="3"/>
<numa>
<cell id="0" cpus="1,2,3" memory="1024">
<distances>
@ -105,7 +106,6 @@
</distances>
</cell>
</numa>
<cache mode="emulate" level="3"/>
</cpu>
<clock offset="utc">
<timer name="rtc" tickpolicy="merge"/>
@ -259,6 +259,7 @@
<feature policy="disable" name="distest"/>
<feature policy="forbid" name="foo"/>
<feature policy="forbid" name="bar"/>
<cache mode="emulate" level="3"/>
<numa>
<cell id="0" cpus="1,2,3" memory="1024">
<distances>
@ -273,7 +274,6 @@
</distances>
</cell>
</numa>
<cache mode="emulate" level="3"/>
</cpu>
<clock offset="utc">
<timer name="rtc" tickpolicy="merge"/>

View File

@ -845,7 +845,7 @@ class XMLBuilder(object):
elif key in childprops:
do_order.insert(0, key)
for key in list(childprops.keys()):
for key in sorted(list(childprops.keys())):
if key not in do_order:
do_order.append(key)