Hello Nir Soffer, Ondřej Svoboda, Dima Kuznetsov, Dan Kenigsberg, Francesco Romani,
I'd like you to do a code review. Please visit
to review the following change.
Change subject: configfile: sort dict items inserted to config files for consistency. ......................................................................
configfile: sort dict items inserted to config files for consistency.
See comment one at bug.
Change-Id: I7705b046d993cc08eac6b09a6ebba34bd8986620 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1127877 Signed-off-by: Mooli Tayer mtayer@redhat.com Reviewed-on: http://gerrit.ovirt.org/31289 Reviewed-by: Nir Soffer nsoffer@redhat.com Reviewed-by: Ondřej Svoboda osvoboda@redhat.com Reviewed-by: Francesco Romani fromani@redhat.com Reviewed-by: Dima Kuznetsov dkuznets@redhat.com Reviewed-by: Dan Kenigsberg danken@redhat.com --- M lib/vdsm/tool/configurators/configfile.py M tests/toolTests.py 2 files changed, 20 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/32062/1
diff --git a/lib/vdsm/tool/configurators/configfile.py b/lib/vdsm/tool/configurators/configfile.py index d297a5c..62b99b1 100644 --- a/lib/vdsm/tool/configurators/configfile.py +++ b/lib/vdsm/tool/configurators/configfile.py @@ -159,7 +159,7 @@
def _writeEntries(self, f, oldentries): f.write(self._start()) - for key, val in self._entries.iteritems(): + for key, val in sorted(self._entries.items()): if key not in oldentries: f.write("{k}={v}\n".format(k=key, v=val)) f.write(self._end()) diff --git a/tests/toolTests.py b/tests/toolTests.py index 88e249f..f80c97e 100644 --- a/tests/toolTests.py +++ b/tests/toolTests.py @@ -350,6 +350,25 @@ "key3=val3\n" "# end conf-3.4.4\n")
+ def testSort(self): + self._writeConf("") + with ConfigFile(self.tname, + version='3.4.4', + sectionStart="# start conf", + sectionEnd="# end conf") as conf: + conf.addEntry("key3", "val") + conf.addEntry("key2", "val") + conf.addEntry("key1", "val") + conf.addEntry("key4", "val") + + with open(self.tname, 'r') as f: + self.assertEqual(f.read(), "# start conf-3.4.4\n" + "key1=val\n" + "key2=val\n" + "key3=val\n" + "key4=val\n" + "# end conf-3.4.4\n") + def testPrefixAndPrepend(self): self._writeConf("/var/log/libvirt/libvirtd.log {\n" " weekly\n"
Francesco Romani has posted comments on this change.
Change subject: configfile: sort dict items inserted to config files for consistency. ......................................................................
Patch Set 1: Code-Review+1
Dima Kuznetsov has posted comments on this change.
Change subject: configfile: sort dict items inserted to config files for consistency. ......................................................................
Patch Set 1: Code-Review+1
Nir Soffer has posted comments on this change.
Change subject: configfile: sort dict items inserted to config files for consistency. ......................................................................
Patch Set 2: Code-Review+1
Yaniv Bronhaim has posted comments on this change.
Change subject: configfile: sort dict items inserted to config files for consistency. ......................................................................
Patch Set 2: Code-Review+2
mooli tayer has posted comments on this change.
Change subject: configfile: sort dict items inserted to config files for consistency. ......................................................................
Patch Set 2: Verified+1
Yaniv Bronhaim has submitted this change and it was merged.
Change subject: configfile: sort dict items inserted to config files for consistency. ......................................................................
configfile: sort dict items inserted to config files for consistency.
See comment one at bug.
Change-Id: I7705b046d993cc08eac6b09a6ebba34bd8986620 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1127877 Signed-off-by: Mooli Tayer mtayer@redhat.com Reviewed-on: http://gerrit.ovirt.org/31289 Reviewed-by: Nir Soffer nsoffer@redhat.com Reviewed-by: Ondřej Svoboda osvoboda@redhat.com Reviewed-by: Francesco Romani fromani@redhat.com Reviewed-by: Dima Kuznetsov dkuznets@redhat.com Reviewed-by: Dan Kenigsberg danken@redhat.com Reviewed-on: http://gerrit.ovirt.org/32062 Reviewed-by: Yaniv Bronhaim ybronhei@redhat.com --- M lib/vdsm/tool/configurators/configfile.py M tests/toolTests.py 2 files changed, 20 insertions(+), 1 deletion(-)
Approvals: Nir Soffer: Looks good to me, but someone else must approve Yaniv Bronhaim: Looks good to me, approved mooli tayer: Verified Dima Kuznetsov: Looks good to me, but someone else must approve Francesco Romani: Looks good to me, but someone else must approve
oVirt Jenkins CI Server has posted comments on this change.
Change subject: configfile: sort dict items inserted to config files for consistency. ......................................................................
Patch Set 3:
Build Failed
http://jenkins.ovirt.org/job/vdsm_3.5_create-rpms_merged/120/ : FAILURE
vdsm-patches@lists.fedorahosted.org