]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
ftests: Add support for shell commands in containers
authorTom Hromatka <tom.hromatka@oracle.com>
Wed, 28 Oct 2020 14:08:59 +0000 (14:08 +0000)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 2 Nov 2020 22:00:33 +0000 (15:00 -0700)
Add support for shell commands to Container.run() method.
The parameter, shell_bool, is passed directly to Run.run()
and is ultimately sent on to subprocess.Popen().  As the
name implies, when shell_bool is set to true, the requested
command will be executed through the shell.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
ftests/container.py

index 948018e63ce36d3641b745d604be8ac6eeb8335b..8fc468d05a50e47e724086b5ff894a700930d8dc 100644 (file)
@@ -126,7 +126,7 @@ class Container(object):
 
         return Run.run(cmd)
 
-    def run(self, cntnr_cmd):
+    def run(self, cntnr_cmd, shell_bool=False):
         cmd = list()
 
         if self.privileged:
@@ -148,7 +148,7 @@ class Container(object):
         else:
             raise ContainerError('Unsupported command type')
 
-        return Run.run(cmd).decode('ascii')
+        return Run.run(cmd, shell_bool=shell_bool).decode('ascii')
 
     def start(self):
         cmd = list()