Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
swh-fuse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Lambert
swh-fuse
Commits
845b5d8c
Commit
845b5d8c
authored
4 years ago
by
vlorentz
Browse files
Options
Downloads
Patches
Plain Diff
cli: Don't show a traceback or warning if the config file does not exist
parent
57400588
No related branches found
Branches containing commit
Tags
v0.5.3
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swh/fuse/cli.py
+21
-17
21 additions, 17 deletions
swh/fuse/cli.py
with
21 additions
and
17 deletions
swh/fuse/cli.py
+
21
−
17
View file @
845b5d8c
...
...
@@ -66,23 +66,27 @@ def fuse(ctx, config_file):
if
not
config_file
:
config_file
=
DEFAULT_CONFIG_PATH
try
:
conf
=
config
.
read_raw_config
(
config
.
config_basepath
(
config_file
))
if
not
conf
:
raise
ValueError
(
f
"
Cannot parse configuration file:
{
config_file
}
"
)
if
config_file
==
DEFAULT_CONFIG_PATH
:
try
:
conf
=
conf
[
"
swh
"
][
"
fuse
"
]
except
KeyError
:
pass
# recursive merge not done by config.read
conf
=
config
.
merge_configs
(
DEFAULT_CONFIG
,
conf
)
except
Exception
:
logging
.
warning
(
"
Using default configuration (cannot load custom one)
"
,
exc_info
=
True
)
if
os
.
path
.
isfile
(
config_file
):
try
:
conf
=
config
.
read_raw_config
(
config
.
config_basepath
(
config_file
))
if
not
conf
:
raise
ValueError
(
f
"
Cannot parse configuration file:
{
config_file
}
"
)
if
config_file
==
DEFAULT_CONFIG_PATH
:
try
:
conf
=
conf
[
"
swh
"
][
"
fuse
"
]
except
KeyError
:
pass
# recursive merge not done by config.read
conf
=
config
.
merge_configs
(
DEFAULT_CONFIG
,
conf
)
except
Exception
:
logging
.
warning
(
"
Using default configuration (cannot load custom one)
"
,
exc_info
=
True
)
conf
=
DEFAULT_CONFIG
else
:
logging
.
info
(
"
Using default configuration
"
)
conf
=
DEFAULT_CONFIG
logging
.
debug
(
"
Read configuration:
\n
%s
"
,
yaml
.
dump
(
conf
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment