Alon Bar-Lev has uploaded a new change for review.

Change subject: network: firewalld: fix service removal
......................................................................

network: firewalld: fix service removal

Change-Id: I4058f3f3bb1284b6ed6b279ca30a7deb676766a3
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M ChangeLog
M src/plugins/otopi/network/firewalld.py
2 files changed, 26 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/42/19342/1

diff --git a/ChangeLog b/ChangeLog
index 3ff04e9..fdff7c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
  * core: do not load plugins from empty directories.
  * core: support binary file transaction.
  * packagers: yum: support disable transaction rollback.
+ * network: firewalld: fix service deletion.
 
 2013-08-26 - Version 1.1.0
 
diff --git a/src/plugins/otopi/network/firewalld.py 
b/src/plugins/otopi/network/firewalld.py
index b44cbab..0eeceb3 100644
--- a/src/plugins/otopi/network/firewalld.py
+++ b/src/plugins/otopi/network/firewalld.py
@@ -80,7 +80,13 @@
             pass
 
     FIREWALLD_SERVICES_DIR = '/etc/firewalld/services'
-    _ZONE_RE = re.compile(r'^\w+$')
+    _ZONE_RE = re.compile(
+        flags=re.VERBOSE,
+        pattern=r"""
+            ^
+            (?P<zone>\w+)
+        """
+    )
     _INTERFACE_RE = re.compile(
         flags=re.VERBOSE,
         pattern=r"""
@@ -141,13 +147,15 @@
             #0.3.3 has changed output
             zone_name = None
             for line in stdout:
-                if self._ZONE_RE.match(line):
-                    zone_name = line
-                elif self._INTERFACE_RE.match(line):
-                    devices = self._INTERFACE_RE.match(
-                        line
-                    ).group('interfaces')
-                    zones[zone_name] = devices.split()
+                zoneMatch = self._ZONE_RE.match(line)
+                if zoneMatch is not None:
+                    zone_name = zoneMatch.group('zone')
+                else:
+                    interfacesMatch = self._INTERFACE_RE.match(line)
+                    if interfacesMatch is not None:
+                        zones[zone_name] = interfacesMatch.group(
+                            'interfaces'
+                        ).split()
 
         return zones
 
@@ -170,13 +178,15 @@
         zones = {}
         zone_name = None
         for line in stdout:
-            if self._ZONE_RE.match(line):
-                zone_name = line
-            elif self._SERVICE_RE.match(line):
-                services = self._SERVICE_RE.match(
-                    line
-                ).group('services')
-                zones[zone_name] = services.split()
+            zoneMatch = self._ZONE_RE.match(line)
+            if zoneMatch is not None:
+                zone_name = zoneMatch.group('zone')
+            else:
+                servicesMatch = self._SERVICE_RE.match(line)
+                if servicesMatch is not None:
+                    zones[zone_name] = servicesMatch.group(
+                        'services'
+                    ).split()
 
         return zones
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4058f3f3bb1284b6ed6b279ca30a7deb676766a3
Gerrit-PatchSet: 1
Gerrit-Project: otopi
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to