Blob Blame History Raw
commit 449be745f0b7e43f54fdbab9f19873a64ca73a8f
Author: Thomas Woerner <twoerner@redhat.com>
Date:   Fri Jul 15 19:17:48 2016 +0200

    firewall.command: Get proper firewall error code from D-BusExceptions
    
    The msg still contains the dbus exception prefix, therefore the firewall error
    code could not be looked up.

diff --git a/src/firewall/command.py b/src/firewall/command.py
index a87aded..7c06ba1 100644
--- a/src/firewall/command.py
+++ b/src/firewall/command.py
@@ -128,7 +128,7 @@ class FirewallCommand(object):
                                              message % item), code)
                     _errors += 1
             except DBusException as msg:
-                code = FirewallError.get_code(str(msg))
+                code = FirewallError.get_code(msg.get_dbus_message())
                 if len(option) > 1:
                     self.print_warning("Warning: %s" % msg.get_dbus_message())
                     continue
@@ -151,7 +151,7 @@ class FirewallCommand(object):
             try:
                 action_method(*call_item)
             except DBusException as msg:
-                code = FirewallError.get_code(str(msg))
+                code = FirewallError.get_code(msg.get_dbus_message())
                 if len(option) > 1:
                     self.print_warning("Warning: %s" % msg.get_dbus_message())
                 else:
@@ -220,7 +220,7 @@ class FirewallCommand(object):
             try:
                 res = query_method(*call_item)
             except DBusException as msg:
-                code = FirewallError.get_code(str(msg))
+                code = FirewallError.get_code(msg.get_dbus_message())
                 if len(option) > 1:
                     self.print_warning("Warning: %s" % msg.get_dbus_message())
                     continue