Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jgstew committed Oct 14, 2023
1 parent 55bf631 commit b0ccf77
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/computers_delete_by_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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)
Expand All @@ -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))
Expand Down

0 comments on commit b0ccf77

Please sign in to comment.