Blame SOURCES/0046-fix-rich-use-correct-error-code-for-invalid-priority.patch

725d6a
From 32de2767e869970877c19c8919e37de375351bc1 Mon Sep 17 00:00:00 2001
725d6a
From: Eric Garver <eric@garver.life>
725d6a
Date: Thu, 6 Aug 2020 08:24:02 -0400
725d6a
Subject: [PATCH] fix(rich): use correct error code for invalid priority
725d6a
725d6a
Fixes: 3a0e79b1cfe4 ("fix: core: rich: Catch ValueError on non-numeric priority values")
725d6a
(cherry picked from commit e1562ba92caec988c7cf397b2fa77b8d41592c7e)
725d6a
(cherry picked from commit 5a4e35317a32422dec4acffc845a6651f65680da)
725d6a
---
725d6a
 src/firewall/core/rich.py           | 2 +-
725d6a
 src/tests/regression/rhbz1689429.at | 8 ++++----
725d6a
 2 files changed, 5 insertions(+), 5 deletions(-)
725d6a
725d6a
diff --git a/src/firewall/core/rich.py b/src/firewall/core/rich.py
725d6a
index eb4a2d2d9669..86c0c998a478 100644
725d6a
--- a/src/firewall/core/rich.py
725d6a
+++ b/src/firewall/core/rich.py
725d6a
@@ -382,7 +382,7 @@ class Rich_Rule(object):
725d6a
                     try:
725d6a
                         self.priority = int(attr_value)
725d6a
                     except ValueError:
725d6a
-                        raise FirewallError(errors.INVALID_RULE, "invalid 'priority' attribute value '%s'." % attr_value)
725d6a
+                        raise FirewallError(errors.INVALID_PRIORITY, "invalid 'priority' attribute value '%s'." % attr_value)
725d6a
                 elif attr_name:
725d6a
                     if attr_name == 'protocol':
725d6a
                         err_msg = "wrong 'protocol' usage. Use either 'rule protocol value=...' or  'rule [forward-]port protocol=...'."
725d6a
diff --git a/src/tests/regression/rhbz1689429.at b/src/tests/regression/rhbz1689429.at
725d6a
index 5701607d660f..9157c9544ffc 100644
725d6a
--- a/src/tests/regression/rhbz1689429.at
725d6a
+++ b/src/tests/regression/rhbz1689429.at
725d6a
@@ -1,11 +1,11 @@
725d6a
 FWD_START_TEST([rich rule invalid priority])
725d6a
 AT_KEYWORDS(rich rhbz1689429)
725d6a
 
725d6a
-FWD_CHECK([--add-rich-rule='rule priority=foo accept'], 122, [],
725d6a
-	  [Error: INVALID_RULE: invalid 'priority' attribute value 'foo'.
725d6a
+FWD_CHECK([--add-rich-rule='rule priority=foo accept'], 139, [],
725d6a
+	  [Error: INVALID_PRIORITY: invalid 'priority' attribute value 'foo'.
725d6a
 ])
725d6a
-FWD_CHECK([--permanent --add-rich-rule='rule priority=foo accept'], 122, [],
725d6a
-	  [Error: INVALID_RULE: invalid 'priority' attribute value 'foo'.
725d6a
+FWD_CHECK([--permanent --add-rich-rule='rule priority=foo accept'], 139, [],
725d6a
+	  [Error: INVALID_PRIORITY: invalid 'priority' attribute value 'foo'.
725d6a
 ])
725d6a
 FWD_RELOAD
725d6a
 
725d6a
-- 
725d6a
2.27.0
725d6a