[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 16/16] Add cehck for execute command, since it will only work in lxc containers



---
 bin/virt-sandbox-service | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index 1cce6a5..fe659e2 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -971,6 +971,9 @@ def fullpath(cmd):
     return cmd
 
 def execute(args):
+    if args.uri != "lxc:///":
+        raise ValueError(_("Can only execute commands inside of linux containers."))
+        
     myexec = [ "virsh", "-c", args.uri, "lxc-enter-namespace" ]
 #    myexec = [ "virt-sandbox-service-util", "execute" ]
     if args.noseclabel:
@@ -1120,7 +1123,7 @@ def gen_connect_args(subparser):
 
 def gen_execute_args(subparser):
     parser = subparser.add_parser("execute",
-                                  help=_("Execute a command within a sandbox container"))
+                                  help=_("Execute a command within a sandbox container. Only available for lxc:///"))
     parser.add_argument("-N", "--noseclabel", dest="noseclabel",
                         default=False, action="store_true",
                         help=_("do not modify the label of the executable process.  By default all commands execute with the label of the sandbox"))
-- 
1.8.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]