Page MenuHomeSoftware Heritage

cli: config: add error handling and logging when parsing
ClosedPublic

Authored by haltode on Oct 19 2020, 1:02 PM.

Diff Detail

Repository
rDFUSE FUSE virtual file system
Branch
feature/fix-config-parsing
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 16435
Build 25313: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 25312: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D4302 (id=15197)

Rebasing onto e178e7c4e2...

Current branch diff-target is up to date.
Changes applied before test
commit 6905647a04deda7f16d5756428f48dda2662a018
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 19 12:59:37 2020 +0200

    cli: config: add error handling and logging when parsing
    
    Closes T2711.

See https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/101/ for more details.

zack requested changes to this revision.Oct 19 2020, 1:17 PM
zack added a subscriber: zack.
zack added inline comments.
swh/fuse/cli.py
64

"Loading configuration from: {config_file}"

67

"Cannot parse configuration file: {config_file}"

69–75

I think this is unneeded (no need to babysit the user) and in fact wrong in a context in which there is a single global.yml which is used by all SWH tools, which might then legitimately lack a swh > fuse stanza.

If we log where the conffile is loaded from and what's the actual loaded configuration after that, we're good I think.

78

this should be a logging.warning

also s/get/load/

This revision now requires changes to proceed.Oct 19 2020, 1:17 PM

Build is green

Patch application report for D4302 (id=15199)

Rebasing onto e178e7c4e2...

Current branch diff-target is up to date.
Changes applied before test
commit 3b33e3c99088642876bb2a96b49b8bd121f8c5bb
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 19 12:59:37 2020 +0200

    cli: config: add error handling and logging when parsing
    
    Closes T2711.

See https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/102/ for more details.

This is fine. Two things to do before merge though:

  • make sure the commit message is mainly about non-ignoring user configuration, because this is the big change here, the logging is a nice addition but is marginal
  • consider turning this warning logging.warning("No swh.fuse stanza found in global configuration") into just pass, because, again, it would be entirely legitimate for the user to have a global.yml without that stanza, so it's not even something to be warned about (and the user will know from other messages that their conf is not being used)
This revision is now accepted and ready to land.Oct 19 2020, 1:32 PM

Rework commit message + remove unnecessary logging warning

Build is green

Patch application report for D4302 (id=15200)

Rebasing onto e178e7c4e2...

Current branch diff-target is up to date.
Changes applied before test
commit 6bb4deb717ee5ca3267506d91e6c4658b6de7182
Author: Thibault Allançon <haltode@gmail.com>
Date:   Mon Oct 19 12:59:37 2020 +0200

    cli: do not ignore user config when reading global.yml
    
    Closes T2711.

See https://jenkins.softwareheritage.org/job/DFUSE/job/tests-on-diff/103/ for more details.