Package: openvswitch
Version: 2.10.0+2018.08.28+git.8ca7c82b7d+ds1-12
Severity: normal
Tags: patch

Hi,

logrotate will fail if `/var/run/openvswitch` exists, but no `.pid` file
in this directory (e.g. because openvswitch is not running):

```
/var/run/openvswitch/*.pid: open: No such file or directory
ovs-appctl: cannot read pidfile "/var/run/openvswitch/*.pid" (No such file or 
directory)
```

Replace `*.pid` glob (which could not match and return `*.pid`) by a
find command. A patch for that is attached.

-- 
Benjamin Drung

DevOps Engineer and Debian & Ubuntu Developer
Platform Integration (IONOS Cloud)

1&1 IONOS SE | Greifswalder Str. 207 | 10405 Berlin | Germany
E-mail: [email protected] | Web: www.ionos.de

Hauptsitz Montabaur, Amtsgericht Montabaur, HRB 24498

Vorstand: Dr. Christian Böing, Hüseyin Dogan, Dr. Martin Endreß,
Hans-Henning Kettler, Matthias Steinberg, Achim Weiß
Aufsichtsratsvorsitzender: Markus Kadelke


Member of United Internet
>From 950a5840c3e2cc351f60d878d007308345f1fee8 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <[email protected]>
Date: Wed, 18 Mar 2020 11:45:30 +0100
Subject: [PATCH] Fix logrotate if openvswitch is not running

logrotate will fail if `/var/run/openvswitch` exists, but no `.pid` file
in this directory (e.g. because openvswitch is not running):

```
/var/run/openvswitch/*.pid: open: No such file or directory
ovs-appctl: cannot read pidfile "/var/run/openvswitch/*.pid" (No such file or 
directory)
```

Replace `*.pid` glob (which could not match and return `*.pid`) by a
find command.

Signed-off-by: Benjamin Drung <[email protected]>
---
 debian/openvswitch-switch.logrotate | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/openvswitch-switch.logrotate 
b/debian/openvswitch-switch.logrotate
index a7a71bdd9..0c2920e3a 100644
--- a/debian/openvswitch-switch.logrotate
+++ b/debian/openvswitch-switch.logrotate
@@ -8,7 +8,7 @@
     postrotate
     # Tell Open vSwitch daemons to reopen their log files
     if [ -d /var/run/openvswitch ]; then
-        for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
+        find /var/run/openvswitch -name '*.pid' -printf "%f\n" | while read -r 
pidfile; do
             ovs-appctl -t "${pidfile%%.pid}" vlog/reopen
         done
     fi
-- 
2.20.1

Reply via email to