Script duplicity_bin
[hide private]
[frames] | no frames]

Script duplicity_bin

Classes [hide private]
  Restart
Class to aid in restart of inc or full backup.
Functions [hide private]
string
get_passphrase(n, action, for_signing=False)
Check to make sure passphrase is indeed needed, then get the passphrase from environment, from gpg-agent, or user
int
dummy_backup(tarblock_iter)
Fake writing to backend, but do go through all the source paths.
int
restart_position_iterator(tarblock_iter)
Fake writing to backend, but do go through all the source paths.
int
write_multivol(backup_type, tarblock_iter, man_outfp, sig_outfp, backend)
Encrypt volumes of tarblock_iter and write to backend
fileobj
get_man_fileobj(backup_type)
Return a fileobj opened for writing, save results as manifest
fileobj
get_sig_fileobj(sig_type)
Return a fileobj opened for writing, save results as signature
void
full_backup(col_stats)
Do full backup of directory to backend, using archive_dir
 
check_sig_chain(col_stats)
Get last signature chain for inc backup, or None if none available
void
print_statistics(stats, bytes_written)
If globals.print_statistics, print stats after adding bytes_written
void
incremental_backup(sig_chain)
Do incremental backup of directory to backend, using archive_dir
void
list_current(col_stats)
List the files current in the archive (examining signature only)
void
restore(col_stats)
Restore archive in globals.backend to globals.local_path
 
restore_get_patched_rop_iter(col_stats)
Return iterator of patched ROPaths of desired restore data
 
restore_get_enc_fileobj(backend, filename, volume_info)
Return plaintext fileobj from encrypted filename on backend
void
restore_check_hash(volume_info, vol_path)
Check the hash of vol_path path against data in volume_info
void
restore_add_sig_check(fileobj)
Require signature when closing fileobj matches sig in gpg_profile
void
verify(col_stats)
Verify files, logging differences
void
cleanup(col_stats)
Delete the extraneous files in the current backend
void
remove_all_but_n_full(col_stats)
Remove backup files older than the last n full backups.
void
remove_old(col_stats)
Remove backup files older than globals.remove_time from backend
void
sync_archive()
Synchronize local archive manifest file and sig chains to remote archives.
void
check_last_manifest(col_stats)
Check consistency and hostname/directory of last manifest
void
check_resources(action)
Check for sufficient resources:
 
log_startup_parms(verbosity=5)
log Python, duplicity, and system versions
 
main()
Start/end here
void
with_tempdir(fn)
Execute function and guarantee cleanup of tempdir is called
Variables [hide private]
  exit_val = None
hash(x)
  __package__ = None
hash(x)
Function Details [hide private]

get_passphrase(n, action, for_signing=False)

 

Check to make sure passphrase is indeed needed, then get the passphrase from environment, from gpg-agent, or user

If n=3, a password is requested and verified. If n=2, the current password is verified. If n=1, a password is requested without verification for the time being.

Parameters:
  • n (int) - verification level for a passphrase being requested
  • action (string) - action to perform
  • for_signing (boolean) - true if the passphrase is for a signing key, false if not
Returns: string
passphrase

dummy_backup(tarblock_iter)

 

Fake writing to backend, but do go through all the source paths.

Parameters:
  • tarblock_iter (tarblock_iter) - iterator for current tar block
Returns: int
constant 0 (zero)

restart_position_iterator(tarblock_iter)

 

Fake writing to backend, but do go through all the source paths. Stop when we have processed the last file and block from the last backup. Normal backup will proceed at the start of the next volume in the set.

Parameters:
  • tarblock_iter (tarblock_iter) - iterator for current tar block
Returns: int
constant 0 (zero)

write_multivol(backup_type, tarblock_iter, man_outfp, sig_outfp, backend)

 

Encrypt volumes of tarblock_iter and write to backend

backup_type should be "inc" or "full" and only matters here when picking the filenames. The path_prefix will determine the names of the files written to backend. Also writes manifest file. Returns number of bytes written.

Parameters:
  • backup_type (string) - type of backup to perform, either 'inc' or 'full'
  • tarblock_iter (tarblock_iter) - iterator for current tar block
  • backend (callable backend object) - I/O backend for selected protocol
Returns: int
bytes written

get_man_fileobj(backup_type)

 

Return a fileobj opened for writing, save results as manifest

Save manifest in globals.archive_dir gzipped. Save them on the backend encrypted as needed.

Parameters:
  • man_type (string) - either "full" or "new"
Returns: fileobj
fileobj opened for writing

get_sig_fileobj(sig_type)

 

Return a fileobj opened for writing, save results as signature

Save signatures in globals.archive_dir gzipped. Save them on the backend encrypted as needed.

Parameters:
  • sig_type (string) - either "full-sig" or "new-sig"
Returns: fileobj
fileobj opened for writing

full_backup(col_stats)

 

Do full backup of directory to backend, using archive_dir

Parameters:
  • col_stats (CollectionStatus object) - collection status
Returns: void
void

check_sig_chain(col_stats)

 

Get last signature chain for inc backup, or None if none available

Parameters:
  • col_stats (CollectionStatus object) - collection status

print_statistics(stats, bytes_written)

 

If globals.print_statistics, print stats after adding bytes_written

Returns: void
void

incremental_backup(sig_chain)

 

Do incremental backup of directory to backend, using archive_dir

Returns: void
void

list_current(col_stats)

 

List the files current in the archive (examining signature only)

Parameters:
  • col_stats (CollectionStatus object) - collection status
Returns: void
void

restore(col_stats)

 

Restore archive in globals.backend to globals.local_path

Parameters:
  • col_stats (CollectionStatus object) - collection status
Returns: void
void

restore_get_patched_rop_iter(col_stats)

 

Return iterator of patched ROPaths of desired restore data

Parameters:
  • col_stats (CollectionStatus object) - collection status

restore_get_enc_fileobj(backend, filename, volume_info)

 

Return plaintext fileobj from encrypted filename on backend

If volume_info is set, the hash of the file will be checked, assuming some hash is available. Also, if globals.sign_key is set, a fatal error will be raised if file not signed by sign_key.

restore_check_hash(volume_info, vol_path)

 

Check the hash of vol_path path against data in volume_info

Returns: void
void

restore_add_sig_check(fileobj)

 

Require signature when closing fileobj matches sig in gpg_profile

Returns: void
void

verify(col_stats)

 

Verify files, logging differences

Parameters:
  • col_stats (CollectionStatus object) - collection status
Returns: void
void

cleanup(col_stats)

 

Delete the extraneous files in the current backend

Parameters:
  • col_stats (CollectionStatus object) - collection status
Returns: void
void

remove_all_but_n_full(col_stats)

 

Remove backup files older than the last n full backups.

Parameters:
  • col_stats (CollectionStatus object) - collection status
Returns: void
void

remove_old(col_stats)

 

Remove backup files older than globals.remove_time from backend

Parameters:
  • col_stats (CollectionStatus object) - collection status
Returns: void
void

sync_archive()

 

Synchronize local archive manifest file and sig chains to remote archives. Copy missing files from remote to local as needed to make sure the local archive is synchronized to remote storage.

Returns: void
void

check_last_manifest(col_stats)

 

Check consistency and hostname/directory of last manifest

Parameters:
  • col_stats (CollectionStatus object) - collection status
Returns: void
void

check_resources(action)

 

Check for sufficient resources:

  • temp space for volume build
  • enough max open files

Put out fatal error if not sufficient to run

Parameters:
  • action (string) - action in progress
Returns: void
void

with_tempdir(fn)

 

Execute function and guarantee cleanup of tempdir is called

Parameters:
  • fn (callable function) - function to execute
Returns: void
void