diff --git a/src/gvm_sync_targets/cli/__init__.py b/src/gvm_sync_targets/cli/__init__.py index 8c4b759..00dfe63 100644 --- a/src/gvm_sync_targets/cli/__init__.py +++ b/src/gvm_sync_targets/cli/__init__.py @@ -77,6 +77,10 @@ def gvm_sync_targets( if resp.targets: target = resp.targets[0] click.echo(target) + if target.tasks: + target.tasks.tasks + else: + pass else: gmp.create_target("All Hosts", asset_hosts_filter="") diff --git a/src/gvm_sync_targets/models/targets_response.py b/src/gvm_sync_targets/models/targets_response.py index d77dba7..906a22f 100644 --- a/src/gvm_sync_targets/models/targets_response.py +++ b/src/gvm_sync_targets/models/targets_response.py @@ -56,7 +56,7 @@ class Task(Resource, tag="task"): class Tasks(Resource, tag="tasks"): - tasks: list[Task] = element() + tasks: list[Task] = element(default_factory=list) class Target(Resource, tag="target"): @@ -74,7 +74,7 @@ class Target(Resource, tag="target"): reverse_lookup_unify: IntBoolean = element() alive_tests: str = element() allow_simultaneous_ips: IntBoolean = element() - tasks: Tasks = element() + tasks: Tasks | None = None class GetTargetsResponse(Response, tag="get_targets_response"):