Closed ameukam closed 6 years ago
This is expected. Please see the "Addressing Archives" section of the README.
Is is expected that program print traceback? Should we rather write nicer error message. Something like:
diff --git a/glacier.py b/glacier.py
index 7f6cad7..df5e31c 100755
--- a/glacier.py
+++ b/glacier.py
@@ -599,6 +599,8 @@ class App(object):
self.args.vault, name)
except KeyError:
raise ConsoleError('archive %r not found' % name)
+ except sqlalchemy.orm.exc.MultipleResultsFound
+ raise ConsoleError('Two archives with same name. Use "id:" prefix. See "Addressing Archives" in README.md.')
vault = self.connection.get_vault(self.args.vault)
vault.delete_archive(archive_id)
self.cache.delete_archive(self.args.vault, name)
Written from top of my head and not tested.
That seems reasonable, thanks.
I uploaded the same file 2 times. i got this error when i want to delete.
Traceback (most recent call last): File "/usr/local/bin/glacier", line 730, in
App().main()
File "/usr/local/bin/glacier", line 716, in main
self.args.func()
File "/usr/local/bin/glacier", line 587, in archive_delete
self.args.vault, self.args.name)
File "/usr/local/bin/glacier", line 145, in get_archive_id
result = self._get_archive_query_by_ref(vault, ref).one()
File "/usr/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2023, in one
"Multiple rows were found for one()")
sqlalchemy.orm.exc.MultipleResultsFound: Multiple rows were found for one()