From b0ccf7715364325343998ff3210d130e71327720 Mon Sep 17 00:00:00 2001 From: JGStew Date: Sat, 14 Oct 2023 15:28:27 -0400 Subject: [PATCH] add comments --- examples/computers_delete_by_file.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/computers_delete_by_file.py b/examples/computers_delete_by_file.py index 8d4ef3b..1b358a1 100644 --- a/examples/computers_delete_by_file.py +++ b/examples/computers_delete_by_file.py @@ -14,7 +14,9 @@ def main(): bes_conn = besapi.besapi.get_bes_conn_using_config_file() bes_conn.login() + # get the directory this script is running within: script_dir = os.path.dirname(os.path.realpath(__file__)) + # get the file "computers_delete_by_file.txt" within the folder of the script: comp_file_path = os.path.join(script_dir, "computers_delete_by_file.txt") comp_file_lines = [] @@ -28,8 +30,10 @@ def main(): computers = '"' + '";"'.join(comp_file_lines) + '"' + # by default, this will only return computers that have not reported in >90 days: session_relevance = f"unique values of ids of bes computers whose(now - last report time of it > 90 * day AND exists elements of intersections of (it; sets of ({computers})) of sets of (name of it; id of it as string))" + # get session relevance result of computer ids from list of computer ids or computer names: results = bes_conn.session_relevance_array(session_relevance) # print(results) @@ -38,6 +42,7 @@ def main(): print("WARNING: No computers found to delete!") return None + # delete computers: for item in results: if item.strip() != "": computer_id = str(int(item))