Add windows publisher
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
		@@ -19,13 +19,17 @@
 | 
				
			|||||||
package shim
 | 
					package shim
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"bytes"
 | 
				
			||||||
	"context"
 | 
						"context"
 | 
				
			||||||
	"net"
 | 
						"net"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
 | 
						"os/exec"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	winio "github.com/Microsoft/go-winio"
 | 
						winio "github.com/Microsoft/go-winio"
 | 
				
			||||||
	"github.com/containerd/containerd/events"
 | 
						"github.com/containerd/containerd/events"
 | 
				
			||||||
 | 
						"github.com/containerd/containerd/namespaces"
 | 
				
			||||||
	"github.com/containerd/ttrpc"
 | 
						"github.com/containerd/ttrpc"
 | 
				
			||||||
 | 
						"github.com/containerd/typeurl"
 | 
				
			||||||
	"github.com/pkg/errors"
 | 
						"github.com/pkg/errors"
 | 
				
			||||||
	"github.com/sirupsen/logrus"
 | 
						"github.com/sirupsen/logrus"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@@ -68,7 +72,6 @@ func handleSignals(logger *logrus.Entry, signals chan os.Signal) error {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (l *remoteEventsPublisher) Publish(ctx context.Context, topic string, event events.Event) error {
 | 
					func (l *remoteEventsPublisher) Publish(ctx context.Context, topic string, event events.Event) error {
 | 
				
			||||||
	/* TOOD: JTERRY75: Implement publish for windows
 | 
					 | 
				
			||||||
	ns, _ := namespaces.Namespace(ctx)
 | 
						ns, _ := namespaces.Namespace(ctx)
 | 
				
			||||||
	encoded, err := typeurl.MarshalAny(event)
 | 
						encoded, err := typeurl.MarshalAny(event)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
@@ -80,17 +83,5 @@ func (l *remoteEventsPublisher) Publish(ctx context.Context, topic string, event
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	cmd := exec.CommandContext(ctx, l.containerdBinaryPath, "--address", l.address, "publish", "--topic", topic, "--namespace", ns)
 | 
						cmd := exec.CommandContext(ctx, l.containerdBinaryPath, "--address", l.address, "publish", "--topic", topic, "--namespace", ns)
 | 
				
			||||||
	cmd.Stdin = bytes.NewReader(data)
 | 
						cmd.Stdin = bytes.NewReader(data)
 | 
				
			||||||
	c, err := Default.Start(cmd)
 | 
						return cmd.Run()
 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	status, err := Default.Wait(cmd, c)
 | 
					 | 
				
			||||||
	if err != nil {
 | 
					 | 
				
			||||||
		return err
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if status != 0 {
 | 
					 | 
				
			||||||
		return errors.New("failed to publish event")
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	*/
 | 
					 | 
				
			||||||
	return nil
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user