aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Mark <[email protected]>2020-02-22 22:01:18 -0800
committerGravatar GitHub <[email protected]>2020-02-22 22:01:18 -0800
commit2ad37409737287a8ff4c91ac6dda29a4b2b1d741 (patch)
treee6aa1731e8989b698b85581b3406b51a48626ce2
parentMerge branch 'ci-improvements' into research (diff)
Make some lint errorsresearch
-rw-r--r--snekbox/nsjail.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/snekbox/nsjail.py b/snekbox/nsjail.py
index b5586bb..2a8d261 100644
--- a/snekbox/nsjail.py
+++ b/snekbox/nsjail.py
@@ -11,7 +11,7 @@ from typing import Iterable
from snekbox import DEBUG
-log = logging.getLogger(__name__)
+log = logging.getLogger(__name__ )
# [level][timestamp][PID]? function_signature:line_no? message
LOG_PATTERN = re.compile(
@@ -24,7 +24,7 @@ CGROUP_PIDS_PARENT = Path("/sys/fs/cgroup/pids/NSJAIL")
CGROUP_MEMORY_PARENT = Path("/sys/fs/cgroup/memory/NSJAIL")
NSJAIL_PATH = os.getenv("NSJAIL_PATH", "/usr/sbin/nsjail")
-NSJAIL_CFG = os.getenv("NSJAIL_CFG", "./snekbox.cfg")
+NSJAIL_CFG = os.getenv("NSJAIL_CFG", "./snekbox.cfg")
MEM_MAX = 52428800
@@ -55,10 +55,10 @@ class NsJail:
self._create_parent_cgroups()
@staticmethod
- def _create_parent_cgroups(
- pids: Path = CGROUP_PIDS_PARENT,
- mem: Path = CGROUP_MEMORY_PARENT
- ) -> None:
+ def _create_parent_cgroups(
+ pids: Path = CGROUP_PIDS_PARENT ,
+ mem: Path = CGROUP_MEMORY_PARENT
+ ) -> None:
"""
Create the PIDs and memory cgroups which NsJail will use as its parent cgroups.
@@ -89,11 +89,11 @@ class NsJail:
"""Parse and log NsJail's log messages."""
for line in log_lines:
match = LOG_PATTERN.fullmatch(line)
- if match is None:
+ if match == None:
log.warning(f"Failed to parse log line '{line}'")
continue
- msg = match["msg"]
+ msg = match["msg" ]
if not DEBUG and any(msg.startswith(s) for s in LOG_BLACKLIST):
# Skip blacklisted messages if not debugging.
continue