David Johnson's picture

I am attempting to use the tklbam-backup command with the --address switch as follows:

>tklbam-backup --address file:///<localdir-path>

Which ever way I try to use this the initial creation of the backup runs as normal but the duplicity phase fails with the following error:

Traceback (most recent call last):
  File "/usr/bin/tklbam-backup", line 510, in <module>
  File "/usr/bin/tklbam-backup", line 464, in main
  File "/usr/lib/tklbam/duplicity.py", line 234, in __call__
    cleanup_command.run(target.secret, target.credentials)
  File "/usr/lib/tklbam/duplicity.py", line 67, in run
    if creds.type in ('devpay', 'iamuser'):
AttributeError: 'NoneType' object has no attribute 'type'

Running a backup to the hub is working fine, so I seem to have a working configuration otherwise.

This is running on an up to date debian 7 system with python version 2.7.3

Can you point me in the direction of what I'm doing wrong?

Thanks, DJ

David Poole's picture

Restoring a backup from another machine onto a clean Redmine install.

root@redmine ~# tklbam-restore --keyfile=/root/backup/key --address=file:///root/backup
Executing Duplicity to download file:///root/backup to /tmp/tklbam-PbQyop

// started squid: caching downloaded backup archives to /var/cache/tklbam/restore

# duplicity --archive-dir=/var/cache/duplicity --s3-unencrypted-connection file:///root/backup /tmp/tklbam-PbQyop
Traceback (most recent call last):
  File "/usr/bin/tklbam-restore", line 553, in <module>
  File "/usr/bin/tklbam-restore", line 491, in main
    backup_extract_path = get_backup_extract()
  File "/usr/bin/tklbam-restore", line 463, in get_backup_extract
    downloader(raw_download_path, target, log=_print if not silent else None, debug=opt_debug, force=opt_force)
  File "/usr/lib/tklbam/duplicity.py", line 179, in __call__
    command.run(target.secret, target.credentials, debug=debug)
  File "/usr/lib/tklbam/duplicity.py", line 67, in run
    if creds.type in ('devpay', 'iamuser'):
AttributeError: 'NoneType' object has no attribute 'type'


Digging into the source.


David Poole's picture

Checking if creds was non-None helped me get past the error. The function definition allows for creds to default to None so I think it's valid for creds to be None.

I'm just posting in the hope it would be useful for a tklbam developer. Do not trust my code, please.

My diff is getting blocked by the spam filter.  Trying simple code list.

/usr/lib/tklbam/duplicity.py (line numbers on left)

 64     def run(self, passphrase, creds=None, debug=False):

 67         if creds and creds.type in ('devpay', 'iamuser'):

 75         elif creds and creds.type == 'iamrole':


Liraz Siri's picture

Thanks for reporting this. I'm working on fixing this right now.
Liraz Siri's picture

This turned out to be an embarrasingly simple regression that slipped through my testing.

I pushed a fix to GitHub. Alon will update the repository tomorrow morning.

Alon Swartz's picture

Package archive repository updated with latest tklbam version.

Add new comment