Skip to content

Commit

Permalink
Use falcoctl for psp conversion
Browse files Browse the repository at this point in the history
Instead of using a psp_conv binary built in the falco build, download
falcoctl 0.0.2 and use its "falcoctl convert psp" subcommand to perform
the conversion.
  • Loading branch information
mstemm committed Oct 14, 2019
1 parent c78f2b0 commit b6ff1aa
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/falco_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
import sets
import glob
import shutil
import stat
import subprocess
import sys
import urllib

from avocado import Test
from avocado.utils import process
Expand All @@ -39,7 +42,8 @@ def setUp(self):

self.falcodir = self.params.get('falcodir', '/', default=build_dir)

self.psp_conv_path = os.path.join(build_dir, "tools", "psp_conv", "falco-psp-conv")
self.psp_conv_path = os.path.join(build_dir, "falcoctl")
self.psp_conv_url = "https://github.com/falcosecurity/falcoctl/releases/download/0.0.2/falcoctl-0.0.2-linux-amd64"

self.stdout_is = self.params.get('stdout_is', '*', default='')
self.stderr_is = self.params.get('stderr_is', '*', default='')
Expand Down Expand Up @@ -435,7 +439,14 @@ def test(self):

# Possibly run psp converter
if self.psp_file != "":
conv_cmd = '{} --psp {} --rules {}'.format(

if not os.path.isfile(self.psp_conv_path):
self.log.info("Downloading {} to {}".format(self.psp_conv_url, self.psp_conv_path))

urllib.urlretrieve(self.psp_conv_url, self.psp_conv_path)
os.chmod(self.psp_conv_path, stat.S_IEXEC)

conv_cmd = '{} convert psp --psp-path {} --rules-path {}'.format(
self.psp_conv_path, os.path.join(self.basedir, self.psp_file), self.psp_rules_file)

conv_proc = process.SubProcess(conv_cmd)
Expand Down

0 comments on commit b6ff1aa

Please sign in to comment.