cskoglun / ciscodnacbackupctl

Other
15 stars 2 forks source link

Deleted all of my backups #10

Closed MJohnson3150 closed 2 years ago

MJohnson3150 commented 2 years ago

I had 3 backups saved and I ran the following:

ciscodnacbackupctl schedule_purge --interval daily --keep 2 --hour 10:15

When it ran, I got the following output:

Your backups will be deleted daily at 10:15 Deleted backup (backup_id='6') Deleted backup (backup_id='9') Deleted backup (backup_id='1') Deleted backup (backup_id='1') Deleted backup (backup_id='c') Deleted backup (backup_id='2') Deleted backup (backup_id='2') Deleted backup (backup_id='0') Deleted backup (backup_id='-') Cisco DNA Center isn't available - Error: (Error occurs during delete_backup().)

When I think checked my backup folder everything, including the folder itself was gone.

Good job. A backup utility that deletes backups! Wonderful.

robertcsapo commented 2 years ago

@MJohnson3150 seems like the Cisco DNA Center API allowed wild card id. We could add enforcement for uuid string as id.

robertcsapo commented 2 years ago

Based on the output above, the delete function didn't handle id correctly. I've made some changes to the code. This will handle the id correctly and enforce 36 chars for uuid.

https://github.com/cskoglun/ciscodnacbackupctl/blob/2042c91558eabff0b7e66e3c875acd93afc89c5f/ciscodnacbackupctl/__init__.py#L320