diagnostics module

Provides the ability to collect diagnostic information on Back In Time.

These are version numbers of the dependent tools, environment variables, paths, operating system and the like. This is used to enhance error reports and to enrich them with the necessary information as uncomplicated as possible.

diagnostics._get_extern_versions(cmd, pattern=None, try_json=False, error_pattern=None)[source]

Get the version of an external tools using subprocess.Popen.

Parameters:
  • cmd (list[str]) – Commandline arguments that will be passed to Popen().

  • pattern (str) – A regex pattern to extract the version string from the commands output.

  • try_json (bool) – Interpret the output as json first (default: False). If it could be parsed the result is a dict

  • error_pattern (str) – Regex pattern to identify a message in the output that indicates an error.

Returns:

Version information as str or dict. The latter is used if the cmd requested offer its information in JSON format. None if the error_pattern did match (to indicate an error).

diagnostics._get_os_release()[source]

Try to get the name and version of the operating system used.

First it extract infos from the file /etc/os-release. Because not all GNU Linux distributions follow the standards it will also look for alternative release files (pattern: /etc/*release). See http://linuxmafia.com/faq/Admin/release-files.html for examples.

Returns:

A string with the name of the operating system, e.g. “Debian GNU/Linux 11 (bullseye)” or a dictionary if alternative release files where found.

diagnostics._get_qt_information()[source]

Collect Version and Theme information from Qt.

If environment variable DISPLAY is set a temporary QApplication instances is created.

diagnostics._replace_username_paths(result, username)[source]

User’s real HOME path and login name are replaced with surrogtes.

This is because of security reasons.

Parameters:
  • result (dict) – Dict possibly containing the username and its home path.

  • username (str) – The user’s real login name to look for.

Returns:

A dictionary with replacements.

diagnostics.collect_diagnostics()[source]

Collect information about environment, versions of tools and packages used by Back In Time.

The information can be used e.g. for debugging and bug reports.

Returns:

A nested dictionary.

Return type:

dict

diagnostics.collect_minimal_diagnostics()[source]

Collect minimal information about backintime and the operating system.

Returns:

A nested dictionary.

Return type:

dict