apprell / proxmox-autosnap

Automatic ZFS Snapshot Script for Proxmox VE 5, 6, 7 and 8
73 stars 15 forks source link

Add option --date-iso-format for snapshot names #7

Closed jocelynj closed 1 year ago

apprell commented 1 year ago

Hi, thanks for your interest in this script.

It's fine, but I don't really like that the name contradicts the allowed characters in Proxmox when you create a snapshot from the web interface

image

I'd replace all the "-" with "_".

suffix = "_" + suffix_datetime.isoformat(timespec="seconds").replace("-", "_").replace(":", "_")
snapshot = re.search(r'auto{0}(\d+|_\d{{4}}_\d{{2}}_\d{{2}}T\d{{2}}_\d{{2}}_\d{{2}})'.format(label),
                     snapshot.replace('`->', '').split()[0])

And then the name would fit the requirement of Proxmox I understand that it already works, but I would stick to the requirements of Proxmox

jocelynj commented 1 year ago

You're right - I couldn't find an explicit list of allowed characters, but should have thought of the web interface. I will push a change.