Skip to content

Commit

Permalink
Add --skip-parent argument (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
Schamper authored Sep 21, 2023
1 parent a61e3b1 commit fcd8e18
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 7 additions & 5 deletions acquire/acquire.py
Original file line number Diff line number Diff line change
Expand Up @@ -2250,11 +2250,13 @@ def acquire_children_and_targets(target: Target, args: argparse.Namespace) -> No

log.info("")

try:
files = acquire_target(target, args, args.start_time)
except Exception:
log.exception("Failed to acquire target")
raise
files = []
if (args.children and not args.skip_parent) or not args.children:
try:
files.extend(acquire_target(target, args, args.start_time))
except Exception:
log.exception("Failed to acquire target")
raise

if args.children:
for child in target.list_children():
Expand Down
4 changes: 4 additions & 0 deletions acquire/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def create_argument_parser(profiles: dict, modules: dict) -> argparse.ArgumentPa
action="store_true",
help="collect all children in addition to main target",
)
parser.add_argument("--skip-parent", action="store_true", help="skip parent collection (when using --children)")

parser.add_argument(
"--force-fallback",
Expand Down Expand Up @@ -286,6 +287,9 @@ def check_and_set_acquire_args(
setattr(args, "cagent_key", args.config.get("cagent_key"))
setattr(args, "cagent_certificate", args.config.get("cagent_certificate"))

if not args.children and args.skip_parent:
raise ValueError("--skip-parent can only be set with --children")


def get_user_name() -> str:
try:
Expand Down

0 comments on commit fcd8e18

Please sign in to comment.