check_file_latency doesn't work with filepaths
The check_file_latency
plugin raises a TypeError
when attempting to resolve -p/--path
point to a file:
$ python3 -m igwn_monitor.plugins.check_file_latency -p /tmp/x509up_u1000
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/duncan/git/igwn-monitoring-plugins/igwn_monitor/plugins/check_file_latency.py", line 213, in <module>
sys.exit(main())
^^^^^^
File "/home/duncan/git/igwn-monitoring-plugins/igwn_monitor/plugins/check_file_latency.py", line 194, in main
status, message = check_file_latency(
^^^^^^^^^^^^^^^^^^^
File "/home/duncan/git/igwn-monitoring-plugins/igwn_monitor/plugins/check_file_latency.py", line 113, in check_file_latency
path = find_latest(Path(path), key=file_end)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/duncan/git/igwn-monitoring-plugins/igwn_monitor/plugins/check_file_latency.py", line 68, in find_latest
return sorted(glob.iglob(path), key=key)[-1]
^^^^^^^^^^^^^^^^
File "/home/duncan/opt/mambaforge/envs/py311/lib/python3.11/glob.py", line 48, in iglob
root_dir = pathname[:0]
~~~~~~~~^^^^
TypeError: 'PosixPath' object is not subscriptable