6 def fetch_instances(domain: str):
7 print("DEBUG: Fetching instances for domain:", domain)
8 peerlist = fba.get_peers(domain)
10 if (peerlist is None):
11 print("ERROR: Cannot fetch peers:", domain)
14 for instance in peerlist:
15 instance = instance.lower()
16 if instance.find("@") > 0:
17 print("WARNING: Bad instance name,domain:", instance, domain)
21 for domain in fba.blacklist:
22 if domain in instance:
26 # NOISY-DEBUG: print("DEBUG: domain is blacklisted:", domain)
29 # NOISY-DEBUG: print("DEBUG: Handling instance:", instance)
32 "SELECT domain FROM instances WHERE domain = ? LIMIT 1", (instance,)
35 if fba.c.fetchone() == None:
36 # NOISY-DEBUG: print("DEBUG: Adding new instance:", instance)
37 fba.add_instance(instance)
41 except Exception as e:
42 print("ERROR:", e, instance)
45 instance = sys.argv[1]
48 fetch_instances(instance)
50 # Loop through some instances
52 "SELECT domain FROM instances WHERE software IS NOT NULL ORDER BY rowid DESC"
55 for instance in fba.c.fetchall():
57 for domain in fba.blacklist:
58 if domain in instance[0]:
62 # NOISY-DEBUG: print("DEBUG: domain is blacklisted:", instance)
65 print("DEBUG: Fetching instances for instance:", instance[0])
66 fetch_instances(instance[0])