Commit 14ad0507 authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt
Browse files

Copy back in some old code

parent 5a23a263
......@@ -22,6 +22,25 @@ def call(*a, **kw): # decorator builder
return decorator
def dump_eap_configs(discovery):
# download in paralell, write in series
with ThreadPoolExecutor(max_workers=300) as e:
futures = []
for instance in discovery["instances"]:
for profile in instance["profiles"]:
if profile.get("oauth") == False:
name = profile["id"]
url = profile["eapconfig_endpoint"]
futures.append((name, e.submit(requests.get, url)))
for name, future in futures:
with open(f"eap-configs/{name}.eap-config", "w") as f:
print("wrote", name)
def get_eap_configs(discovery, profile_handler):
with ThreadPoolExecutor(max_workers=N_WORKERS) as e:
for instance in discovery["instances"]: # feature request: ability to download a partial EAP config for Oauth=True profiles
......@@ -38,9 +57,6 @@ def get_eap_configs(discovery, profile_handler):
resp = future.result()
if not resp.ok: return # todo, print why?
#with open(f"eap-configs/{profile["id"]}.eap-config", "w") as f:
# f.write(eap_config_xml)
eap_config_xml = resp.text
profile_handler(profile["id"], eap_config_xml, profile, instance)
......@@ -236,7 +252,6 @@ def run_rad_eap_test(*,
get_eap_configs(DISCOVERY, parse_profile)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment