From 739f9c7ea015a9fb8f79590e79b85cbced30960c Mon Sep 17 00:00:00 2001 From: Julien Fortin Date: Thu, 17 Jan 2019 11:45:35 +0800 Subject: [PATCH] scheduler: ifupdown2 scripts: log warning on EACCES exception (Fixes #89) ifupdown2 behaviour significantly diverges from ifupdown on debian stretch. Original ifupdown uses run-parts which supposedly doesn't run non-executable files in the directory. However, ifupdown2 doesn't seem to make this distinction. This patch will log warning EACCES exceptions (instead of log error) and exit 0 Reported-by: George Diamantopoulos Signed-off-by: Julien Fortin --- debian/changelog | 1 + ifupdown2/ifupdown/scheduler.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 0dfc055..6a079aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ ifupdown2 (1.2.5-1) unstable; urgency=medium + * Fix: ifupdown2 scripts: log warning on EACCES exception (Fixes #89) * Fix: debian: install sysvinit script (closes: #918775) * Fix: debian: postinst: remove diversion after upgrade from stretch (closes: #919443) diff --git a/ifupdown2/ifupdown/scheduler.py b/ifupdown2/ifupdown/scheduler.py index a3f467a..940c4f1 100644 --- a/ifupdown2/ifupdown/scheduler.py +++ b/ifupdown2/ifupdown/scheduler.py @@ -7,6 +7,7 @@ # interface scheduler # +import os import sys from sets import Set @@ -132,7 +133,10 @@ class ifaceScheduler(): try: utils.exec_command(mname, env=cenv) except Exception, e: - ifupdownobj.log_error('%s: %s %s' % (ifacename, op, str(e))) + if "permission denied" in str(e).lower(): + ifupdownobj.logger.warning('%s: %s %s' % (ifacename, op, str(e))) + else: + ifupdownobj.log_error('%s: %s %s' % (ifacename, op, str(e))) @classmethod def run_iface_list_ops(cls, ifupdownobj, ifaceobjs, ops): -- 2.39.2