INN commit: branches/2.6 (4 files)
INN Commit
rra at isc.org
Wed Dec 9 21:04:31 UTC 2020
Date: Wednesday, December 9, 2020 @ 13:04:31
Author: iulius
Revision: 10442
Improve logs when Python filters are not installed
Modified:
branches/2.6/innd/cc.c
branches/2.6/innd/python.c
branches/2.6/nnrpd/python.c
branches/2.6/scripts/innreport_inn.pm
--------------------------+
innd/cc.c | 4 ++--
innd/python.c | 14 ++++++++++++--
nnrpd/python.c | 10 +++++++---
scripts/innreport_inn.pm | 2 ++
4 files changed, 23 insertions(+), 7 deletions(-)
Modified: innd/cc.c
===================================================================
--- innd/cc.c 2020-12-09 21:03:56 UTC (rev 10441)
+++ innd/cc.c 2020-12-09 21:04:31 UTC (rev 10442)
@@ -1355,8 +1355,8 @@
#endif
#ifdef DO_PYTHON
syslog(L_NOTICE, "reloading pyfilter");
- PYreadfilter();
- syslog(L_NOTICE, "reloaded pyfilter OK");
+ if (PYreadfilter())
+ syslog(L_NOTICE, "reloaded pyfilter OK");
#endif
p = "all";
}
Modified: innd/python.c
===================================================================
--- innd/python.c 2020-12-09 21:03:56 UTC (rev 10441)
+++ innd/python.c 2020-12-09 21:04:31 UTC (rev 10442)
@@ -684,8 +684,8 @@
PyObject *result;
if (!Py_IsInitialized()) {
- syslog(L_ERROR, "python is not initialized");
- return 0;
+ syslog(L_NOTICE, "python is not initialized");
+ return 0;
}
/* If there is a filter running, let it clean up first. */
@@ -740,7 +740,17 @@
{
const ARTHEADER *hp;
size_t hdrcount;
+ char *path;
+ path = concatpath(innconf->pathfilter, INN_PATH_PYTHON_STARTUP);
+ if (access(path, R_OK) < 0) {
+ syslog(L_NOTICE, "pyfilter %s not installed", path);
+ PYfilter(false);
+ free(path);
+ return;
+ }
+ free(path);
+
/* Add path for innd module. The environment variable PYTHONPATH
* does it; one can also append innconf->pathfilter to sys.path once
* Python has been initialized. */
Modified: nnrpd/python.c
===================================================================
--- nnrpd/python.c 2020-12-09 21:03:56 UTC (rev 10441)
+++ nnrpd/python.c 2020-12-09 21:04:31 UTC (rev 10442)
@@ -392,12 +392,16 @@
/*
** Initialize dynamic access control code.
*/
-
void
PY_dynamic_init (char* file)
{
- dynamic_file = xstrdup(file);
- PY_use_dynamic = true;
+ if (!access(file, R_OK)) {
+ syslog(L_NOTICE, "pyfilter %s not installed", path);
+ return;
+ }
+
+ dynamic_file = xstrdup(file);
+ PY_use_dynamic = true;
}
Modified: scripts/innreport_inn.pm
===================================================================
--- scripts/innreport_inn.pm 2020-12-09 21:03:56 UTC (rev 10441)
+++ scripts/innreport_inn.pm 2020-12-09 21:04:31 UTC (rev 10442)
@@ -473,6 +473,8 @@
return 1 if $left =~ /^reloading pyfilter$/o;
return 1 if $left =~ /^reloaded pyfilter OK$/o;
return 1 if $left =~ /^python interpreter initialized OK$/o;
+ return 1 if $left =~ /^python is not initialized$/o;
+ return 1 if $left =~ /^pyfilter .+ not installed$/o;
return 1 if $left =~ /^python method \w+ not found$/o;
return 1 if $left =~ /^python: First load, so I can do initialization stuff\.$/o;
return 1 if $left =~ /^python: filter_before_reload executing\.\.\.$/o;
More information about the inn-committers
mailing list