Commit 2588b9e Use check_output instead of the docker library.

2 files Authored and Committed by davidcarlos a year ago
Use check_output instead of the docker library.

    - related #38

    
 1 @@ -1,7 +1,6 @@
 2   """This module provides functions to run static analyzers."""
 3   
 4 - import docker
 5 - from subprocess import check_output
 6 + import subprocess
 7   
 8   def run(analyzer, sources):
 9       """Run a static analyzer on a given package.
10 @@ -10,9 +9,8 @@
11       `sources` is the absolute path for the uncompressed package. Returns
12       a analysis results.
13       """
14 -     volume = {sources: {'bind': '/src', 'mode': 'Z'}}
15 -     client = docker.from_env(version='auto')
16 -     uid = int(check_output("echo $UID", shell=True))
17 -     return client.containers.run(analyzer, '/src', volumes=volume,
18 -                                  environment={'KISKADEE_UID': uid},
19 -                                  stderr=True, stdout=True, tty=True)
20 +     volume = ''.join([sources, ':', '/src'])
21 +     uid = int(subprocess.check_output("echo $UID", shell=True))
22 +     return subprocess.check_output("docker run -e KISKADEE_UID={} "\
23 +                                 "-v {} {}".format(uid, volume, analyzer),
24 +                                 shell=True, stderr=subprocess.STDOUT)
1 @@ -4,4 +4,4 @@
2   chown -R kiskadee:kiskadee /src
3   chmod -R 755 /src
4   cd /src
5 - flawfinder -S .
6 + flawfinder -S --quiet .