Browse code

Logging driver should receive same file in start/stop request

Signed-off-by: Peter Bücker <peter.buecker@gmail.com>

Peter Bücker authored on 2017/06/08 17:05:52
Showing 2 changed files
... ...
@@ -3,6 +3,7 @@ package logger
3 3
 import (
4 4
 	"io"
5 5
 	"os"
6
+	"strings"
6 7
 	"sync"
7 8
 	"time"
8 9
 
... ...
@@ -18,6 +19,7 @@ type pluginAdapter struct {
18 18
 	driverName   string
19 19
 	id           string
20 20
 	plugin       logPlugin
21
+	basePath     string
21 22
 	fifoPath     string
22 23
 	capabilities Capability
23 24
 	logInfo      Info
... ...
@@ -56,7 +58,7 @@ func (a *pluginAdapter) Close() error {
56 56
 	a.mu.Lock()
57 57
 	defer a.mu.Unlock()
58 58
 
59
-	if err := a.plugin.StopLogging(a.fifoPath); err != nil {
59
+	if err := a.plugin.StopLogging(strings.TrimPrefix(a.fifoPath, a.basePath)); err != nil {
60 60
 		return err
61 61
 	}
62 62
 
... ...
@@ -59,6 +59,7 @@ func makePluginCreator(name string, l *logPluginProxy, basePath string) Creator
59 59
 			driverName: name,
60 60
 			id:         id,
61 61
 			plugin:     l,
62
+			basePath:   basePath,
62 63
 			fifoPath:   filepath.Join(root, id),
63 64
 			logInfo:    logCtx,
64 65
 		}