epicserve / s3-backups

S3 Backups provides easy scripts that system administrators can use to backup data from programs likes PostgreSQL, MySQL, Redis, etc.
http://s3-backups.readthedocs.org/
Other
67 stars 27 forks source link

Exception on archive (IndexError: list index out of range) #10

Open DiogoNeves opened 10 years ago

DiogoNeves commented 10 years ago

Here's the traceback:

Traceback (most recent call last):
  File "/usr/bin/postgres_to_s3.py", line 177, in <module>
    archive(args.schedule_module)
  File "/usr/bin/postgres_to_s3.py", line 106, in __init__
    year = name_parts[-3]
IndexError: list index out of range

After looking at the code, the line that seems to create the wrong list size is 105:

# value of key.name in my execution: mdb/mdb_test_20141117_182804.tar.gz
name_parts = key.name.split('/')

I don't mind submitting a fix but I wasn't sure if this is just me not using it properly :)

DiogoNeves commented 10 years ago

I've currently fixed it by adding an extra folder to the key, but this is a hacky solution. Let me know if you want me to work on a proper code fix :)