tsileo / bakthat

Bakthat is a MIT licensed backup framework written in Python, it's both a command line tool and a Python module that helps you manage backups on Amazon S3/Glacier and OpenStack Swift. It automatically compress, encrypt (symmetric encryption) and upload your files.
http://bakthat.readthedocs.org/en/latest/
MIT License
491 stars 67 forks source link

Problem in rotate_backups function #63

Open tomislater opened 10 years ago

tomislater commented 10 years ago
import bakthat

bakthat_conf = {
    "default": {
        'access_key': 'my_access_key',
        'secret_key': 'my_secret_key',
        'glacier_vault': 'my_vault',
        's3_bucket': '',
        'compress': False,
        'region_name': 'my_region_name'',
         'rotation': {
             'days': 1,
             'first_week_day': 5,
             'months': 0,
             'weeks': 0
         }
    }

bakthat.backup("/home/user/my_log.log", config=bakthat_conf, destination="glacier", prompt="no")  # this guy works

bakthat.rotate_backups("log", config=bakthat_conf, destination="glacier")  # but this guy won't :(

Traceback:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-72-bcaeca070a0e> in <module>()
----> 1 bakthat.rotate_backups("log", config=bakthat_conf, destination="glacier")

/home/tomek/.virtualenv/double/local/lib/python2.7/site-packages/bakthat/__init__.pyc in rotate_backups(filename, destination, profile, config, **kwargs)
    150     deleted = []
    151 
--> 152     backups = Backups.search(filename, destination, profile=profile, config=config)
    153     backups_date = [datetime.fromtimestamp(float(backup.backup_date)) for backup in backups]
    154 

/home/tomek/.virtualenv/double/local/lib/python2.7/site-packages/bakthat/models.pyc in search(cls, query, destination, **kwargs)
     92         conf = config
     93         if kwargs.get("config"):
---> 94             conf = load_config(kwargs.get("config"))
     95 
     96         if not destination:

/home/tomek/.virtualenv/double/local/lib/python2.7/site-packages/bakthat/conf.pyc in load_config(config_file)
     21     """ Try to load a yaml config file. """
     22     config = {}
---> 23     if os.path.isfile(config_file):
     24         log.debug("Try loading config file: {0}".format(config_file))
     25         config = yaml.load(open(config_file))

/home/tomek/.virtualenv/double/lib/python2.7/genericpath.pyc in isfile(path)
     27     """Test whether a path is a regular file"""
     28     try:
---> 29         st = os.stat(path)
     30     except os.error:
     31         return False

TypeError: coercing to Unicode: need string or buffer, dict found