Change 33526

russell_jackson (Russell C. Jackson (Rusty))
Russell C. Jackson (Rusty) committed this change into //guest/russell_jackson/sdp/Maintenance
Request Review
Download .zip
Fix unconditional maintenance emails; add jsonl structured logging across Maintenance/

- Maintenance/maintenance and Maintenance/edge_maintenance (run daily via
  cron, despite the "weekly" naming) were emailing the full run log on
  every single run, success or not, because every step was guarded with
  `|| true` and never reported failure anywhere. Added a run_step helper
  that tracks real failures and wires them into sdp_set_status/
  sdp_set_error; the end-of-run email now only fires when something
  actually failed (subject changed to "... FAILED" to make that obvious).

- Every other script in Maintenance/ (39 Python scripts + create_p4_filelist.sh
  + email.sh; sdputils.py excluded as a pure library with no __main__) now
  emits the same jsonl structured-logging record as the cron scripts in
  common/bin, via sdp_structured_log.py's run() context manager (auto-emits
  success/failure on exit, sys.exit(N), or unhandled exception) or, for the
  two shell scripts, sdp_structured_log.sh's sdp_log_init (auto ERR/EXIT
  trap coverage).

- remove_empty_pending_changes.py: the initial pending-changes listing
  failure path did a bare `return` (swallowed by the auto-emit machinery,
  since a normal return maps to exit code 0/success); now returns 1, and
  per-change delete failures inside the loop also flip the overall exit
  code, so a partially-failed run is correctly logged as a failure instead
  of a silent success.

- pymail.py: usage() called a bare sys.exit() (exit code 0) for both the
  -h/help path AND real bad-invocation paths (missing required args,
  getopt errors) - meaning a bad invocation reported success both to the
  OS and to the structured log. usage() now takes an explicit code
  (default 0, preserving -h's exit-0 convention); the two real error call
  sites pass a nonzero code.
  • Files 44
  • Comments 0
44 edited 0 added 0 deleted
accessdates.py#10
Loading...
addusertogroup.py#5
Loading...
checkusers.py#5
Loading...
checkusers_not_in_group.py#5
Loading...
clean_protect.py#5
Loading...
convert_label_to_autoreload.py#5
Loading...
countrevs.py#5
Loading...
create_p4_filelist.sh#2
Loading...
creategroups.py#5
Loading...
createusers.py#5
Loading...
del_shelve.py#8
Loading...
delete_unload_clients.py#10
Loading...
delusers.py#5
Loading...
edge_maintenance#14
Loading...
email.sh#6
Loading...
email_pending_client_deletes.py#11
Loading...
email_pending_user_deletes.py#7
Loading...
group_audit.py#5
Loading...
isitalabel.py#5
Loading...
lowercp.py#5
Loading...
lowertree.py#5
Loading...
maintain_user_from_groups.py#6
Loading...
maintenance#13
Loading...
make_email_list.py#6
Loading...
mirroraccess.py#5
Loading...
p4deleteuser.py#12
Loading...
p4lock.py#5
Loading...
p4unlock.py#5
Loading...
protect_groups.py#5
Loading...
proxysearch.py#5
Loading...
pymail.py#5
Loading...
remove_empty_pending_changes.py#10
Loading...
remove_jobs.py#5
Loading...
removeuserfromgroups.py#5
Loading...
removeuserfromgroups_file.py#4
Loading...
removeusersfromgroup.py#5
Loading...
rollback.py#3
Loading...
setpass.py#5
Loading...
totalusers.py#10
Loading...
unload_clients.py#10
Loading...
unload_clients_with_delete.py#10
Loading...
unload_labels.py#6
Loading...
unloadaccessdates.py#5
Loading...
update-changes.py#5
Loading...
Tip: Use n and p to cycle through the changes.