duplicity.backend module¶
Provides a common interface to all backends and certain sevices intended to be used by the backends themselves.
-
class
duplicity.backend.
Backend
(parsed_url)[source]¶ Bases:
object
See README in backends directory for information on how to write a backend.
-
get_password
()[source]¶ Return a password for authentication purposes. The password will be obtained from the backend URL, the environment, by asking the user, or by some other method. When applicable, the result will be cached for future invocations.
-
munge_password
(commandline)[source]¶ Remove password from commandline by substituting the password found in the URL, if any, with a generic place-holder.
This is intended for display purposes only, and it is not guaranteed that the results are correct (i.e., more than just the ‘:password@’ may be substituted.
-
popen_breaks
= {}¶
-
subprocess_popen
(commandline)[source]¶ Execute the given command line with error check. Returns int Exitcode, string StdOut, string StdErr
Raise a BackendException on failure.
-
use_getpass
= True¶
-
-
class
duplicity.backend.
BackendWrapper
(backend)[source]¶ Bases:
object
Represents a generic duplicity backend, capable of storing and retrieving files.
-
close
()[source]¶ Close the backend, releasing any resources held and invalidating any file objects obtained from the backend.
-
get_data
(filename, parseresults=None)[source]¶ Retrieve a file from backend, process it, return contents.
-
-
class
duplicity.backend.
ParsedUrl
(url_string)[source]¶ Parse the given URL as a duplicity backend URL.
Returns the data of a parsed URL with the same names as that of the standard urlparse.urlparse() except that all values have been resolved rather than deferred. There are no get_* members. This makes sure that the URL parsing errors are detected early.
Raise InvalidBackendURL on invalid URL’s
-
duplicity.backend.
get_backend
(url_string)[source]¶ Instantiate a backend suitable for the given URL, or return None if the given string looks like a local path rather than a URL.
Raise InvalidBackendURL if the URL is not a valid URL.
-
duplicity.backend.
get_backend_object
(url_string)[source]¶ Find the right backend class instance for the given URL, or return None if the given string looks like a local path rather than a URL.
Raise InvalidBackendURL if the URL is not a valid URL.
-
duplicity.backend.
import_backends
()[source]¶ Import files in the duplicity/backends directory where the filename ends in ‘backend.py’ and ignore the rest.
@rtype: void @return: void
-
duplicity.backend.
is_backend_url
(url_string)[source]¶ @return Whether the given string looks like a backend URL.
-
duplicity.backend.
register_backend
(scheme, backend_factory)[source]¶ Register a given backend factory responsible for URL:s with the given scheme.
The backend must be a callable which, when called with a URL as the single parameter, returns an object implementing the backend protocol (i.e., a subclass of Backend).
Typically the callable will be the Backend subclass itself.
This function is not thread-safe and is intended to be called during module importation or start-up.
-
duplicity.backend.
register_backend_prefix
(scheme, backend_factory)[source]¶ Register a given backend factory responsible for URL:s with the given scheme prefix.
The backend must be a callable which, when called with a URL as the single parameter, returns an object implementing the backend protocol (i.e., a subclass of Backend).
Typically the callable will be the Backend subclass itself.
This function is not thread-safe and is intended to be called during module importation or start-up.