WIP: Added debug log entries for borg, borgmatic and os version #750
No reviewers
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#750
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "(deleted):main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This implements changes discussed in #714. This currently break unit and integration tests for borgmatic as it generates additional log entries.
This all looks super useful, and the general approach you've taken makes sense to me. Besides fixing the broken (and possibly brittle) tests, I'd like to see some test coverage for this code, even if it's just a few basic "does not raise" tests to exercise the various code branches. That'd be unit tests if you do mocking, integration if you don't.
Beyond that, I see a few more items to log from the ticket (#714) that you could include if you saw value in them. Were you planning on including any of them or were gonna reduce scope?
@ -73,6 +74,7 @@ def run_configuration(config_filename, config, arguments):
try:
local_borg_version = borg_version.local_borg_version(config, local_path)
yield from log_error_records(f'{config_filename}: Local Borg version: {local_borg_version}', levelno=logging.DEBUG)
Is there any reason this is done here rather than passing
local_borg_version
tolog_versions()
? That would ensure it'd get logged in the same spot as all of your other nice debug log statements.The borg version depends on the config file and
run_configuration()
is called later thanlog_versions()
. Also there is the possibility of having one borg version for each config file, so we cannot really easily collect that inlog_versions()
.Makes sense! Thanks for the explanation.
@ -0,0 +14,4 @@
'''
Logs the platform and the architecture on debug. Also logs the version of borgmatic and python.
'''
logging.debug(f'Borgmatic version: {importlib_metadata.version("borgmatic")}')
borgmatic is always lowercase! (It's a convention often followed by command-line Unix tools.)
Will be fixed
@ -0,0 +28,4 @@
elif 'NAME' in os_release:
logging.debug(f'Distribution name: {os_release["NAME"]}')
if 'VERSION' in os_release:
logging.debug(f'Distribution version: {os_release["VERSION"]}')
What do you think of just logging the following when
'NAME' in os_release:
?That'd be more comparable to the
PRETTY_NAME
case.lgtm
Basically done
Not really something I see value in (the install method should not really matter much when you have the version)
Done
Per hook implementation and depends on the database
MariaDB for example supports
SELECT VERSION();
Will be implemented soon
Will probably be a different pull request as this might be a rather extensive feature
Also better error messages for missing file/wrong permissions is something I am looking at
That all looks good. The main value in knowing the borgmatic install method is when debugging issues related to the installation. For instance, running a crontab when borgmatic is installed into a virtualenv is different than running a crontab when borgmatic comes from a system package.
Just curious.. Did you decide not to finish this one after all?
No I just realized how much code the fixing of the tests will be. I am currently rewriting it since it is outdated anyways and needs more work. I will probably merge 1-2 lines of logging code and 100 lines of unit tests (In a new pull request).
Also since I have some time (around 1 month) between jobs and university I will try to add a podman volume plugin too since I could very well use that.
#792 is the new pull request. So far that one is only for borg versions but I want to take a step at a time.
Sounds good, thanks!
Pull request closed