[node-patches] Change in ovirt-node[master]: ui: Handle incorrect entries in /etc/default/ovirt

fabiand at fedoraproject.org fabiand at fedoraproject.org
Tue Feb 19 13:02:26 UTC 2013


Fabian Deutsch has uploaded a new change for review.

Change subject: ui: Handle incorrect entries in /etc/default/ovirt
......................................................................

ui: Handle incorrect entries in /etc/default/ovirt

Previously an exception was raised in the case of an invalid KEY=VALUE
line in the central config file. This case is now handled sanely.

Change-Id: Ia9fcb5ea7808c46320fdc61123ba8132dfdd7a01
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/tui/src/ovirt/node/config/defaults.py
1 file changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/00/12200/1

diff --git a/scripts/tui/src/ovirt/node/config/defaults.py b/scripts/tui/src/ovirt/node/config/defaults.py
index 1267972..3528c3f 100644
--- a/scripts/tui/src/ovirt/node/config/defaults.py
+++ b/scripts/tui/src/ovirt/node/config/defaults.py
@@ -98,10 +98,14 @@
         """
         cfg = {}
         for line in source:
+                line = line.strip()
                 if line.startswith("#"):
                     continue
-                key, value = line.split("=", 1)
-                cfg[key] = value.strip("\"' \n")
+                try:
+                    key, value = line.split("=", 1)
+                    cfg[key] = value.strip("\"' \n")
+                except:
+                    self.logger.error("Failed to parse line: '%s'" % line)
         return cfg
 
     def _write(self, cfg):


--
To view, visit http://gerrit.ovirt.org/12200
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9fcb5ea7808c46320fdc61123ba8132dfdd7a01
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list