inettgmbh / checkmk-proxmox_backup_server

check_mk extension package for Proxmox Backup Server
https://www.inett.de/it-loesungen/checkmk
GNU General Public License v2.0
9 stars 5 forks source link

added fix to correctly escape upid in task log which contains backslashes #5

Closed jens-maus closed 1 year ago

jens-maus commented 1 year ago

This PR fixes an issue with ChecMK always showing GC Task failed if a data store in PBS contains some special characters like -. This results in the UPID in the garbage-collection status step to return something like:

UPID:hostname:0000029A:000001C1:00000013:6417CC30:garbage_collection:test\x2dstore:root@pam:

for a data store called test-store

This is a result of the jq -r '.upid' call in the garbage-collection status step where JQ not only removes the quotes, but also the double-backslashes. However, removing the -r option does not seem to be a valid alternative since this leaves the quotes and also does not make sure the normal $upid is used in line before this single-line change.

With this simple bash char replacement task log is used with the correct escaped string while the command_section call keeps up using the upid returned by garbage-collection status.

marcogabriel commented 1 year ago

Thanks, applied :-)