Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate extended diagnostics (#1300 with #1295) #1310

Merged
merged 2 commits into from
Oct 3, 2022
Merged

Integrate extended diagnostics (#1300 with #1295) #1310

merged 2 commits into from
Oct 3, 2022

Conversation

aryoda
Copy link
Contributor

@aryoda aryoda commented Sep 25, 2022

Integrates:

Changes:

@aryoda
Copy link
Contributor Author

aryoda commented Sep 25, 2022

The output is now:

> ./backintime --diagnostics
{
    "backintime": {
        "name": "Back In Time",
        "version": "1.3.2",
        "config-version": 6,
        "distribution-package": "/home/UsernameReplaced/dev/backintime",
        "started-from": "/home/UsernameReplaced/dev/backintime/common",
        "running_as_root": false,
        "user_callback": "/home/UsernameReplaced/.config/backintime/user-callback",
        "git-branch": "PR/integrate_extended_diagnostics",
        "git-hash": "19c3d25a07a74d4f1023a1c7b1cf8d2d97e5408c"
    },
    "host-setup": {
        "platform": "Linux-5.15.0-48-generic-x86_64-with-glibc2.29",
        "system": "Linux #54~20.04.1-Ubuntu SMP Thu Sep 1 16:17:26 UTC 2022",
        "os-release": "Ubuntu 20.04.5 LTS",
        "display-system": "x11",
        "locale": "en_US, UTF-8",
        "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
    },
    "python-setup": {
        "python": "3.8.10 default Jun 22 2022 20:18:18 CPython GCC 9.4.0",
        "sys.path": [
            "/home/UsernameReplaced/dev/backintime/qt/plugins",
            "/home/UsernameReplaced/dev/backintime/common/plugins",
            "/home/UsernameReplaced/dev/backintime/plugins",
            "/home/UsernameReplaced/dev/backintime/common",
            "/usr/lib/python38.zip",
            "/usr/lib/python3.8",
            "/usr/lib/python3.8/lib-dynload",
            "/usr/local/lib/python3.8/dist-packages",
            "/usr/lib/python3/dist-packages"
        ],
        "qt": "PyQt 5.14.1 / Qt 5.12.8"
    },
    "external-programs": {
        "rsync": "3.1.3",
        "ssh": "OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f  31 Mar 2020",
        "sshfs": "2.10.0",
        "encfs": "(no encfs)",
        "shell": "/bin/bash",
        "shell-version": "GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)"
    }
}

@aryoda
Copy link
Contributor Author

aryoda commented Sep 25, 2022

Just saw that

  • user_callback uses an underscore instead of hyphen
  • running_as_root also uses underscores

Shall I fix this (using hyphens only like everywhere else)?

Copy link
Member

@buhtz buhtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moin,
fine work.

I'm just becoming warm with the GitHub review front-end. I wasn't able to directly edit the files. Maybe because of user rights.
So I added my code change suggestions as comments.

And replacing _ with - is a good idea also.


Returns:
dict: A nested dictionary.
"""
result = {}

USER_REPLACED = 'UsernameReplaced'
USER_REPLACED = 'UsernameReplaced' # replace home folder user names with this dummy name for privacy reasons
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Violates PEP8. Line is to long.

        # Replace home folder user names with this dummy name for
        # privacy reasons.
        USER_REPLACED = 'UsernameReplaced'


pwd_struct = pwd.getpwuid(os.getuid())

# === BACK IN TIME ===
distro_path = _determine_distro_package_folder()
cfg = config.Config() # work-around: Instantiate to get the user-callback folder (should be singleton)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        # work-around: Instantiate to get the user-callback folder
        # (should be singleton)
        cfg = config.Config()

* Add user-callback path to collect_diagnostics()
* Remove TravisCI test failure workaround (was fixed with #1305).
* Correct some typos in comments
@aryoda
Copy link
Contributor Author

aryoda commented Sep 25, 2022

@buhtzz THX for the review. Findings are fixed (rebased), now it's @emtiu turn...

@aryoda
Copy link
Contributor Author

aryoda commented Oct 1, 2022

I have added another commit to

  • add the local and global config file info
  • rename "config-version" to "latest-config-version" (to avoid any confusion with the actual config version in existing config files...)

The backintime node now looks like this:

{
    "backintime": {
        "name": "Back In Time",
        "version": "1.3.2",
        "latest-config-version": 6,                                                # renamed from "config.version"
        "local-config-file": "/home/UsernameReplaced/.config/backintime/config",   # new
        "local-config-file-found": true,                                           # new
        "global-config-file": "/etc/backintime/config",                            # new
        "global-config-file-found": false,                                         # new
        "distribution-package": "/home/UsernameReplaced/dev/backintime",
        "started-from": "/home/UsernameReplaced/dev/backintime/common",
        "running-as-root": false,
        "user-callback": "/home/UsernameReplaced/.config/backintime/user-callback",
        "git-branch": "PR/integrate_extended_diagnostics",
        "git-hash": "74f451260a5abde03d0678d191213dda22940e39"
    },
...

@emtiu
Copy link
Member

emtiu commented Oct 3, 2022

Thanks for the good work, and sorry for being slow to merge ;)

@emtiu emtiu merged commit 4940192 into bit-team:master Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants