diff options
author | Phil Sutter <phil@nwl.cc> | 2021-08-12 19:14:13 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2021-09-13 17:00:51 +0200 |
commit | a8da71864d467c4371dc24cd763fa2c1dfb6cfbb (patch) | |
tree | c96c8a58e254db0b16041a23fcb84cce23ccb359 /iptables-test.py | |
parent | 5166c4451fb837e7d5dbb54a7d7cbf2f0c2469cc (diff) |
tests: iptables-test: Print errors to stderr
No big deal, just pass the extra parameter to the four error print
calls.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables-test.py')
-rwxr-xr-x | iptables-test.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/iptables-test.py b/iptables-test.py index 01966f91..1790da3d 100755 --- a/iptables-test.py +++ b/iptables-test.py @@ -47,7 +47,7 @@ def print_error(reason, filename=None, lineno=None): Prints an error with nice colors, indicating file and line number. ''' print(filename + ": " + Colors.RED + "ERROR" + - Colors.ENDC + ": line %d (%s)" % (lineno, reason)) + Colors.ENDC + ": line %d (%s)" % (lineno, reason), file=sys.stderr) def delete_rule(iptables, rule, filename, lineno): @@ -368,11 +368,12 @@ def main(): EXECUTEABLE = "xtables-nft-multi" if os.getuid() != 0: - print("You need to be root to run this, sorry") + print("You need to be root to run this, sorry", file=sys.stderr) return if not args.netns and not args.no_netns and not spawn_netns(): - print("Cannot run in own namespace, connectivity might break") + print("Cannot run in own namespace, connectivity might break", + file=sys.stderr) if not args.host: os.putenv("XTABLES_LIBDIR", os.path.abspath(EXTENSIONS_PATH)) @@ -388,7 +389,7 @@ def main(): try: log_file = open(LOGFILE, 'w') except IOError: - print("Couldn't open log file %s" % LOGFILE) + print("Couldn't open log file %s" % LOGFILE, file=sys.stderr) return if args.filename: |