Skip to content

Commit

Permalink
adjusted test + permission edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
mlodic committed May 13, 2024
1 parent 453f17d commit 402a1af
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions intel_owl/settings/_util.py
Expand Up @@ -17,9 +17,14 @@
gid = grp.getgrnam("www-data").gr_gid


def set_permissions(directory: Path):
def set_permissions(directory: Path, force_create: bool = False):
if not directory.exists():
raise RuntimeError(f"Directory {directory} does not exists")
# this may happen in case we have added a new directory in the Dockerfile
# but the image has been already built by the user -> see "blint" directory case
if force_create:
os.mkdir(directory)
else:
raise RuntimeError(f"Directory {directory} does not exists")
logger.info(f"setting permissions for {directory}")
os.chown(directory, uid, gid)
for path in directory.rglob("*"):
Expand Down
2 changes: 1 addition & 1 deletion intel_owl/settings/logging.py
Expand Up @@ -17,7 +17,7 @@
BLINT_REPORTS_PATH,
]:
if not STAGE_CI:
set_permissions(path)
set_permissions(path, force_create=True)

DISABLE_LOGGING_TEST = secrets.get_secret("DISABLE_LOGGING_TEST", False) == "True"
INFO_OR_DEBUG_LEVEL = "DEBUG" if DEBUG else "INFO"
Expand Down
2 changes: 1 addition & 1 deletion tests/api_app/analyzers_manager/test_views.py
Expand Up @@ -40,7 +40,7 @@ def test_pull(self):
self.assertIn("status", result)
self.assertTrue(result["status"])

analyzer = "Xlm_Macro_Deobfuscator"
analyzer = "QuarkEngine"
response = self.client.post(f"{self.URL}/{analyzer}/pull")
self.assertEqual(response.status_code, 400)
result = response.json()
Expand Down

0 comments on commit 402a1af

Please sign in to comment.