From 81e32f4e79c3e737375073427819578800183cd4 Mon Sep 17 00:00:00 2001 From: linuxdaemon Date: Tue, 14 May 2024 12:59:14 -0400 Subject: [PATCH] fix: remove duplicates --- src/gvm_sync_targets/cli/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gvm_sync_targets/cli/__init__.py b/src/gvm_sync_targets/cli/__init__.py index 57c7525..86c58f2 100644 --- a/src/gvm_sync_targets/cli/__init__.py +++ b/src/gvm_sync_targets/cli/__init__.py @@ -40,7 +40,7 @@ def gvm_sync_targets( ) as gmp: hosts = read_lines(hosts_file.read()) gmp.authenticate(username, password) - to_add = set(hosts.copy()) + to_add = hosts.copy() to_remove: list[str] = [] for host in get_all_hosts(gmp, details=True): @@ -56,10 +56,10 @@ def gvm_sync_targets( for ip in ips: if ip in to_add: to_add.remove(ip) - elif ip not in hosts: + else: to_remove.append(host.uuid) - for ip in to_add: + for ip in set(to_add): gmp.create_host(ip) for uuid in set(to_remove):