Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle non-unique snapshot names #40

Open
d0ugal opened this issue Nov 15, 2018 · 0 comments
Open

Handle non-unique snapshot names #40

d0ugal opened this issue Nov 15, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@d0ugal
Copy link
Owner

d0ugal commented Nov 15, 2018

As commented in #37. If you use "filename": "snapshot_name" and you create snapshots without a unique name things get a bit weird. (i.e. only calling the snapshot "snapshot" or creating more than one a day only with the date.

It means that the addon will keep trying to replace the snapshot, as it will find a file with the same name but different contents. I can see a couple of options:

  1. Look at all the snapshot names and report an error if the names are not unique and the snapshot_name strategy is used.
  2. Add the slug or date to the end of the snapshot name. This could look a little ugly, but it would be easiest.
  3. Provide a new naming strategy which is "snapshot_date", this will save the snapshots as "Snapshot 2018-11-15 08:34:02" and ignore any name given in Hass.io This would then lose any useful information added in the snapshot name.

The easiest solution is for users to create a unique snapshot name. This is trivial with something like this, which will work unless you make more than one snapshot a second (then you probably have bigger issues!).

name: Automated Backup {{ now().strftime('%Y-%m-%d %H-%M-%S') }}

I'm therefore inclined to update the example in the README to add the time and go with option 1 and display an error and quit if the names are not unique (and the snapshot_name option is used). My only concern here is the repeated support requests as this trips up new users in the future.

@d0ugal d0ugal added the bug Something isn't working label Nov 15, 2018
d0ugal added a commit that referenced this issue Nov 15, 2018
The process doesn't really work if we are uploading based on filename,
and the filename isn't unique.

The safest option is probably then to just drop out and error. We could
improve this in the future, but this change will prevent the addon
constantly re-uploading and overwriting snapshots in dropbox.

Related #40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant