uskudnik / amazon-glacier-cmd-interface

Command line interface for Amazon Glacier
MIT License
375 stars 103 forks source link

Upload does not work, error in tree_hash function #149

Closed bgaillard closed 10 years ago

bgaillard commented 10 years ago

Hi, this is the first time I'm trying to use the Amazon Glacier CMD Interface but with no luck.

I'm getting the following errors :

[ec2-user@ip-10-202-162-223 application-management]$ glacier-cmd -c glacier-cmd.conf --no-bookkeeping --loglevel DEBUG upload quipo "/home/ec2-user/application-management/backups/glacier/2013-11-18 - 11:35:59.gz"
Traceback (most recent call last):
  File "/usr/lib64/python2.6/logging/__init__.py", line 776, in emit
    msg = self.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 654, in format
    return fmt.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 436, in format
    record.message = record.getMessage()
  File "/usr/lib64/python2.6/logging/__init__.py", line 306, in getMessage
    msg = msg % self.args
TypeError: not all arguments converted during string formatting
Traceback (most recent call last):
  File "/usr/bin/glacier-cmd", line 9, in <module>
    load_entry_point('glacier==0.2dev', 'console_scripts', 'glacier-cmd')()
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/glacier.py", line 929, in main
    args.func(args)
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/glacier.py", line 156, in wrapper
    return fn(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/glacier.py", line 309, in upload
    args.name, args.partsize, args.uploadid, args.resume)
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/GlacierWrapper.py", line 65, in wrapper
    ret = fn(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/GlacierWrapper.py", line 231, in glacier_connect_wrap
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/GlacierWrapper.py", line 65, in wrapper
    ret = fn(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/GlacierWrapper.py", line 252, in sdb_connect_wrap
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/GlacierWrapper.py", line 65, in wrapper
    ret = fn(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/GlacierWrapper.py", line 1196, in upload
    writer.close()
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/glaciercorecalls.py", line 179, in close
    bytes_to_hex(tree_hash(self.tree_hashes)),
  File "/usr/lib/python2.6/site-packages/glacier-0.2dev-py2.6.egg/glacier/glaciercorecalls.py", line 65, in tree_hash
    return hashes[0]
IndexError: list index out of range

I tried using those two commands, none of those commands seems to work :

glacier-cmd -c glacier-cmd.conf --no-bookkeeping --loglevel -1 upload quipo "/home/ec2-user/application-management/backups/glacier/2013-11-18 - 11:35:59.gz"
cat "/home/ec2-user/application-management/backups/glacier/2013-11-18 - 11:35:59.gz"| glacier-cmd -c glacier-cmd.conf --no-bookkeeping upload quipo --description "QUIPO Platform" --stdin

I'm getting the following in the logs :

Nov 18 11:56:24 DEBUG    glacier-cmd Validating region.
Nov 18 11:56:24 DEBUG    glacier-cmd Region is valid.
Nov 18 11:56:24 DEBUG    glacier-cmd True
Nov 18 11:56:24 DEBUG    glacier-cmd Connecting to Amazon Glacier.
Nov 18 11:56:24 DEBUG    glacier-cmd                         Connecting to Amazon Glacier with
                        aws_access_key XXXXXXXX
                        aws_secret_key XXXXXXXX
                        region us-east-1
Nov 18 11:56:24 DEBUG    glacier-cmd Using access key provided by client.
Nov 18 11:56:24 DEBUG    glacier-cmd Using secret key provided by client.
Nov 18 11:56:24 DEBUG    glacier-cmd Connecting to Amazon SimpleDB.
Nov 18 11:56:24 DEBUG    glacier-cmd Uploading archive.
Nov 18 11:56:24 DEBUG    glacier-cmd Checking whether vault name is valid.
Nov 18 11:56:24 DEBUG    glacier-cmd Vault name is valid.
Nov 18 11:56:24 DEBUG    glacier-cmd True
Nov 18 11:56:24 DEBUG    glacier-cmd Validating region.
Nov 18 11:56:24 DEBUG    glacier-cmd Region is valid.
Nov 18 11:56:24 DEBUG    glacier-cmd True
Nov 18 11:56:24 DEBUG    glacier-cmd Checking whether vault description is valid.
Nov 18 11:56:24 DEBUG    glacier-cmd Vault description is valid.
Nov 18 11:56:24 DEBUG    glacier-cmd True
Nov 18 11:56:24 INFO     glacier-cmd Starting upload of /home/ec2-user/application-management/backups/glacier/2013-11-18 - 11:35:59.gz to quipo.
Description: /home/ec2-user/application-management/backups/glacier/2013-11-18 - 11:35:59.gz

I'm not really used to code using Python but it seems that the error comes from an access to an array with a not existing index ?

Do you know why this error appears ? Can you help me fix that with a quick workaround ?

Thanks,

Baptiste

bgaillard commented 10 years ago

Ok, I finally found the problem, the archive I tried to upload was empty.

Perhaps a check on the files to archive before beginning an upload would be helpful.

mcr commented 6 years ago

When you say, "was empty", do you mean the file was zero in size?