File: 0002-ENH-verify-that-use_stock_cfg-was-not-provided-while.patch

package info (click to toggle)
fail2ban 1.1.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,076 kB
  • sloc: python: 23,095; sh: 527; xml: 352; perl: 344; makefile: 191
file content (25 lines) | stat: -rw-r--r-- 1,202 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From d1afbb566f0304487b5d578b4aacef8e647ee74b Mon Sep 17 00:00:00 2001
From: Yaroslav Halchenko <debian@onerussian.com>
Date: Sun, 21 Jan 2018 20:16:43 -0500
Subject: [PATCH 2/4] ENH: verify that use_stock_cfg was not provided while
 overriding it

Just found this possibly confusing to outside programmer aspect
so decided to make it more explicit
---
 fail2ban/tests/fail2banclienttestcase.py | 2 ++
 1 file changed, 2 insertions(+)

Index: fail2ban/fail2ban/tests/fail2banclienttestcase.py
===================================================================
--- fail2ban.orig/fail2ban/tests/fail2banclienttestcase.py
+++ fail2ban/fail2ban/tests/fail2banclienttestcase.py
@@ -173,6 +173,8 @@ def _start_params(tmp, use_stock=False,
 			"""Filters list of 'files' to contain only directories (under dir)"""
 			return [f for f in files if isdir(pjoin(dir, f))]
 		shutil.copytree(STOCK_CONF_DIR, cfg, ignore=ig_dirs)
+		assert use_stock_cfg is None, \
+			"We are about to overload use_stock_cfg from the one provided %s" % repr(use_stock_cfg)
 		if use_stock_cfg is None: use_stock_cfg = ('action.d', 'filter.d')
 		# replace fail2ban params (database with memory):
 		r = re.compile(r'^dbfile\s*=')