4
0

fix remove acl

- correction command de retrait des ACL
- suppression des tâches en arrière-plan (on essayait de retirer toutes les ACLs en simultané mais la commande timeout)
This commit is contained in:
Lyanis SOUIDI 2024-12-21 12:26:18 +01:00
parent ac6fc7c6bf
commit 956f37dfd0

View File

@ -3,7 +3,6 @@
import json import json
import subprocess import subprocess
import sys import sys
import threading
def extract_acls(vmid_min, vmid_max, output_file, remove_acl=False, append=False): def extract_acls(vmid_min, vmid_max, output_file, remove_acl=False, append=False):
print("Fetching ACLs...") print("Fetching ACLs...")
@ -34,18 +33,10 @@ def extract_acls(vmid_min, vmid_max, output_file, remove_acl=False, append=False
f.write(f"{path} {user} {role}\n") f.write(f"{path} {user} {role}\n")
if (remove_acl): if (remove_acl):
subprocess.run(["pveum", "acl", "delete", path, users, "--roles", roles]) subprocess.run(["pveum", "acl", "delete", path, "--users", users, "--roles", roles])
# Process each ACL in background
threads = []
for acl_entry in acls: for acl_entry in acls:
thread = threading.Thread(target=process_acl, args=(acl_entry,)) process_acl(acl_entry)
thread.start()
threads.append(thread)
# Wait for all threads to finish
for thread in threads:
thread.join()
print(f"ACLs extracted and saved to {output_file}") print(f"ACLs extracted and saved to {output_file}")