duplicity.dup_main module

class duplicity.dup_main.Restart(last_backup)[source]

Bases: object

Class to aid in restart of inc or full backup. Instance in config.restart if restart in progress.

__init__(last_backup)[source]
checkManifest(mf)[source]
setLastSaved(mf)[source]
setParms(last_backup)[source]
duplicity.dup_main.check_last_manifest(col_stats)[source]

Check consistency and hostname/directory of last manifest

@type col_stats: CollectionStatus object @param col_stats: collection status

@rtype: void @return: void

duplicity.dup_main.check_resources(action)[source]

Check for sufficient resources: - temp space for volume build - enough max open files Put out fatal error if not sufficient to run

@type action: string @param action: action in progress

@rtype: void @return: void

duplicity.dup_main.check_sig_chain(col_stats)[source]

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

@type col_stats: CollectionStatus object @param col_stats: collection status

duplicity.dup_main.cleanup(col_stats)[source]

Delete the extraneous files in the current backend

@type col_stats: CollectionStatus object @param col_stats: collection status

@rtype: void @return: void

duplicity.dup_main.do_backup(action)[source]
duplicity.dup_main.dummy_backup(tarblock_iter)[source]

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

@type tarblock_iter: tarblock_iter @param tarblock_iter: iterator for current tar block

@rtype: int @return: constant 0 (zero)

duplicity.dup_main.full_backup(col_stats)[source]

Do full backup of directory to backend, using archive_dir_path

@type col_stats: CollectionStatus object @param col_stats: collection status

@rtype: void @return: void

duplicity.dup_main.get_man_fileobj(backup_type)[source]

Return a fileobj opened for writing, save results as manifest

Save manifest in config.archive_dir_path gzipped. Save them on the backend encrypted as needed.

@type man_type: string @param man_type: either “full” or “new”

@rtype: fileobj @return: fileobj opened for writing

duplicity.dup_main.get_passphrase(n, action, for_signing=False)[source]

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.

@type n: int @param n: verification level for a passphrase being requested @type action: string @param action: action to perform @type for_signing: boolean @param for_signing: true if the passphrase is for a signing key, false if not @rtype: string @return: passphrase

duplicity.dup_main.get_sig_fileobj(sig_type)[source]

Return a fileobj opened for writing, save results as signature

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

@type sig_type: string @param sig_type: either “full-sig” or “new-sig”

@rtype: fileobj @return: fileobj opened for writing

duplicity.dup_main.getpass_safe(message)[source]
duplicity.dup_main.incremental_backup(sig_chain)[source]

Do incremental backup of directory to backend, using archive_dir_path

@rtype: void @return: void

duplicity.dup_main.list_current(col_stats)[source]

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

@type col_stats: CollectionStatus object @param col_stats: collection status

@rtype: void @return: void

duplicity.dup_main.log_startup_parms(verbosity=5)[source]

log Python, duplicity, and system versions

duplicity.dup_main.main()[source]

Start/end here

duplicity.dup_main.print_statistics(stats, bytes_written)[source]

If config.print_statistics, print stats after adding bytes_written

@rtype: void @return: void

duplicity.dup_main.remove_all_but_n_full(col_stats)[source]

Remove backup files older than the last n full backups.

@type col_stats: CollectionStatus object @param col_stats: collection status

@rtype: void @return: void

duplicity.dup_main.remove_old(col_stats)[source]

Remove backup files older than config.remove_time from backend

@type col_stats: CollectionStatus object @param col_stats: collection status

@rtype: void @return: void

duplicity.dup_main.replicate()[source]

Replicate backup files from one remote to another, possibly encrypting or adding parity.

@rtype: void @return: void

duplicity.dup_main.restart_position_iterator(tarblock_iter)[source]

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.

@type tarblock_iter: tarblock_iter @param tarblock_iter: iterator for current tar block

@rtype: int @return: constant 0 (zero)

duplicity.dup_main.restore(col_stats)[source]

Restore archive in config.backend to config.local_path

@type col_stats: CollectionStatus object @param col_stats: collection status

@rtype: void @return: void

duplicity.dup_main.restore_add_sig_check(fileobj)[source]

Require signature when closing fileobj matches sig in gpg_profile

@rtype: void @return: void

duplicity.dup_main.restore_check_hash(volume_info, vol_path)[source]

Check the hash of vol_path path against data in volume_info

@rtype: boolean @return: true (verified) / false (failed)

duplicity.dup_main.restore_get_enc_fileobj(backend, filename, volume_info)[source]

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 config.sign_key is set, a fatal error will be raised if file not signed by sign_key.

with –ignore-errors set continue on hash mismatch

duplicity.dup_main.restore_get_patched_rop_iter(col_stats)[source]

Return iterator of patched ROPaths of desired restore data

@type col_stats: CollectionStatus object @param col_stats: collection status

duplicity.dup_main.sync_archive(col_stats)[source]

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.

@rtype: void @return: void

duplicity.dup_main.verify(col_stats)[source]

Verify files, logging differences

@type col_stats: CollectionStatus object @param col_stats: collection status

@rtype: void @return: void

duplicity.dup_main.write_multivol(backup_type, tarblock_iter, man_outfp, sig_outfp, backend)[source]

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.

@type backup_type: string @param backup_type: type of backup to perform, either ‘inc’ or ‘full’ @type tarblock_iter: tarblock_iter @param tarblock_iter: iterator for current tar block @type backend: callable backend object @param backend: I/O backend for selected protocol

@rtype: int @return: bytes written