epicserve/s3-backups

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

Opened this issue · 1 comments

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 :)

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 :)