Skip to content

Commit 4711a1c

Browse files
author
Zawadi Done
committed
Apply suggestions code review
1 parent 179f4bf commit 4711a1c

File tree

1 file changed

+13
-12
lines changed
  • dissect/target/plugins/apps/container

1 file changed

+13
-12
lines changed

dissect/target/plugins/apps/container/docker.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ def find_installs(target: Target) -> Iterator[Path]:
339339
default_data_paths = [
340340
# Linux
341341
"/var/lib/docker",
342+
"/var/snap/docker/common/var-lib-docker",
342343
# Windows
343344
"sysvol/ProgramData/docker",
344345
]
@@ -361,21 +362,21 @@ def find_installs(target: Target) -> Iterator[Path]:
361362
yield path
362363

363364
for path in default_config_paths:
364-
if (
365-
(config_file := target.fs.path(path)).exists()
366-
and (data_root_path := get_data_path(config_file))
367-
and (data_root_path := target.fs.path(data_root_path)).exists()
368-
):
369-
yield data_root_path
365+
if (config_file := target.fs.path(path)).exists():
366+
if not (data_path := get_data_path(config_file)):
367+
target.log.info("Unable to get data-root from docker daemon file %s", config_file)
368+
continue
369+
if (data_root_path := target.fs.path(data_path)).exists():
370+
yield data_root_path
370371

371372
for path in user_config_paths:
372373
for user_details in target.user_details.all_with_home():
373-
if (
374-
(config_file := user_details.home_path.joinpath(path)).exists()
375-
and (data_root_path := get_data_path(config_file))
376-
and (data_root_path := target.fs.path(data_root_path)).exists()
377-
):
378-
yield data_root_path
374+
if (config_file := user_details.home_path.joinpath(path)).exists():
375+
if not (data_path := get_data_path(config_file)):
376+
target.log.info("Unable to get data-root from docker daemon file %s", config_file)
377+
continue
378+
if (data_root_path := target.fs.path(data_path)).exists():
379+
yield data_root_path
379380

380381

381382
def convert_timestamp(timestamp: str | None) -> str | None:

0 commit comments

Comments
 (0)