Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions acquire/acquire.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import argparse
import contextlib
import enum
import functools
import io
Expand Down Expand Up @@ -2416,19 +2417,20 @@ def main() -> None:
target_path = f"{target_path}?{target_query}"
target_paths.append(target_path)

# Use esxi_memory_context_manager only if running on ESXi host
if platform.system().lower() == "vmkernel":
context_mgr = esxi_memory_context_manager()
else:
context_mgr = contextlib.nullcontext()

try:
target_name = "Unknown" # just in case open_all already fails
for target in Target.open_all(target_paths):
target_name = "Unknown" # overwrite previous target name
target_name = target.name
log.info("Loading target %s", target_name)
log.info(target)
if target.os == "esxi" and target.name == "local":
# Loader found that we are running on an esxi host
# Perform operations to "enhance" memory
with esxi_memory_context_manager():
files_to_upload = acquire_children_and_targets(target, args)
else:
with context_mgr:
for target in Target.open_all(target_paths):
target_name = "Unknown" # overwrite previous target name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line can be removed no?

Copy link
Contributor

@Miauwkeru Miauwkeru Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, it is there so we do not reuse the previous target_name in case target.name fails

target_name = target.name
log.info("Loading target %s", target_name)
log.info(target)
files_to_upload = acquire_children_and_targets(target, args)
except Exception:
log.error("Failed to acquire target: %s", target_name) # noqa: TRY400
Expand Down
Loading