validate-borgmatic-config -c ~/.config/borgmatic/config.yaml crashes, if hooks is set but empty #604

Closed
opened 2022-10-23 19:09:34 +00:00 by jonasstein · 3 comments

What I'm trying to do and why

validate-borgmatic-config -c ~/.config/borgmatic/config.yaml

where config.yaml has hooks: as last line.

Traceback (most recent call last):
  File "/usr/bin/validate-borgmatic-config", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.10/site-packages/borgmatic/commands/validate_config.py", line 45, in main
    validate.parse_configuration(config_filename, validate.schema_filename())
  File "/usr/lib/python3.10/site-packages/borgmatic/config/validate.py", line 105, in parse_configuration
    logs = normalize.normalize(config_filename, config)
  File "/usr/lib/python3.10/site-packages/borgmatic/config/normalize.py", line 18, in normalize
    healthchecks = config.get('hooks', {}).get('healthchecks')
AttributeError: 'NoneType' object has no attribute 'get'

Environment

app-backup/borgmatic-1.7.4

borgmatic installation method: Gentoo package

#### What I'm trying to do and why validate-borgmatic-config -c ~/.config/borgmatic/config.yaml where config.yaml has hooks: as last line. ``` Traceback (most recent call last): File "/usr/bin/validate-borgmatic-config", line 8, in <module> sys.exit(main()) File "/usr/lib/python3.10/site-packages/borgmatic/commands/validate_config.py", line 45, in main validate.parse_configuration(config_filename, validate.schema_filename()) File "/usr/lib/python3.10/site-packages/borgmatic/config/validate.py", line 105, in parse_configuration logs = normalize.normalize(config_filename, config) File "/usr/lib/python3.10/site-packages/borgmatic/config/normalize.py", line 18, in normalize healthchecks = config.get('hooks', {}).get('healthchecks') AttributeError: 'NoneType' object has no attribute 'get' ``` #### Environment app-backup/borgmatic-1.7.4 **borgmatic installation method:** Gentoo package
Owner

Thanks for reporting this! I've reproduced the same error locally by ending a configuration file with just hooks:. This should hopefully be an easy fix.

Thanks for reporting this! I've reproduced the same error locally by ending a configuration file with just `hooks:`. This should hopefully be an easy fix.
witten added the
bug
label 2022-10-23 20:24:29 +00:00
Owner

This is fixed in master and will be part of the next release. Note that hooks: with no options beneath it is still invalid, but will cause a graceful error now rather than a traceback.

Thanks again for reporting it!

This is fixed in master and will be part of the next release. Note that `hooks:` with no options beneath it is still invalid, but will cause a graceful error now rather than a traceback. Thanks again for reporting it!
Owner

Just released in borgmatic 1.7.5!

Just released in borgmatic 1.7.5!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#604
No description provided.