Skip to content

Commit

Permalink
simplified regex
Browse files Browse the repository at this point in the history
  • Loading branch information
apprell authored Mar 21, 2023
1 parent e04cc67 commit f645fcc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion proxmox-autosnap.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def remove_snapshot(vmid: str, virtualization: str, label: str = 'daily', keep:
snapshots = run_command([virtualization, 'listsnapshot', vmid])

for snapshot in snapshots['message'].splitlines():
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])
snapshot = re.search(r'auto{0}([_0-9T]+$)'.format(label), snapshot.replace('`->', '').split()[0])
if snapshot is not None:
listsnapshot.append(snapshot.group(0))

Expand Down

0 comments on commit f645fcc

Please sign in to comment.