The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/go-lxc/pull/96

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
see patch notes for details
From 9d2976b398263e72e96ebc88c2ae325102300c75 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <ty...@tycho.ws>
Date: Mon, 4 Dec 2017 15:02:57 -0700
Subject: [PATCH 1/2] fix execute defined check

Execute() really just does exec("lxc-execute", "-P", c.configPath()); the
problem here is that if c is undefined, then it doesn't have an on-disk
config path, and this lxc-execute invocation won't work.

I think there's a think-o here, and we really mean "is this container
defined", since it will thusly have a config and this little hack will
work.

Signed-off-by: Tycho Andersen <ty...@tycho.ws>
---
 container.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/container.go b/container.go
index 8e9ba73..690988b 100644
--- a/container.go
+++ b/container.go
@@ -495,7 +495,7 @@ func (c *Container) Execute(args ...string) ([]byte, error) 
{
        c.mu.Lock()
        defer c.mu.Unlock()
 
-       if err := c.makeSure(isNotDefined); err != nil {
+       if err := c.makeSure(isDefined); err != nil {
                return nil, err
        }
 

From 67d98dfe09e9e6dde9cd48cf48a6b1d997418e73 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <ty...@tycho.ws>
Date: Mon, 4 Dec 2017 15:04:29 -0700
Subject: [PATCH 2/2] remove some commented out code

With the immanent arrival of StartExecute(), Execute() is probably going to
be enshrined in hackery-whackery for the rest of time. So let's get rid of
this commented out code.

Signed-off-by: Tycho Andersen <ty...@tycho.ws>
---
 container.go | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/container.go b/container.go
index 690988b..09cbe15 100644
--- a/container.go
+++ b/container.go
@@ -517,18 +517,6 @@ func (c *Container) Execute(args ...string) ([]byte, 
error) {
        }
 
        return output, nil
-       /*
-               cargs := makeNullTerminatedArgs(args)
-               if cargs == nil {
-                       return ErrAllocationFailed
-               }
-               defer freeNullTerminatedArgs(cargs, len(args))
-
-               if !bool(C.go_lxc_start(c.container, 1, cargs)) {
-                       return ErrExecuteFailed
-               }
-               return nil
-       */
 }
 
 // Stop stops the container.
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to