[lnst] TestPktCounter: fix error when dport option is None

Jiří Pírko jirka at fedoraproject.org
Fri Feb 8 12:12:18 UTC 2013


commit ca5db5e13d27b142c93cbc835a697ed13094145f
Author: Ondrej Lichtner <olichtne at redhat.com>
Date:   Fri Feb 8 11:09:46 2013 +0100

    TestPktCounter: fix error when dport option is None
    
    The dport option is not mandatory, but when not specified the
    constructed iptables command would contain the string "None" where the
    dport value would be. This commnit fixes that.
    
    Signed-off-by: Ondrej Lichtner <olichtne at redhat.com>

 test_modules/TestPktCounter.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/test_modules/TestPktCounter.py b/test_modules/TestPktCounter.py
index 727d472..7eec92c 100644
--- a/test_modules/TestPktCounter.py
+++ b/test_modules/TestPktCounter.py
@@ -23,7 +23,10 @@ def get_pkt_count(indev_name, dport, proto):
         p_indev_name = "\*"
     if proto:
         p_proto = proto
-        p_protodport = "%s dpt:%s" % (proto, dport)
+        if dport:
+            p_protodport = "%s dpt:%s" % (proto, dport)
+        else:
+            p_protodport = ""
     else:
         p_proto = "all"
         p_protodport = ""


More information about the LNST-developers mailing list