Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
installsystems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Seblu
installsystems
Commits
2761c8fc
Commit
2761c8fc
authored
13 years ago
by
Sebastien Luttringer
Browse files
Options
Downloads
Patches
Plain Diff
fix loading of parameters from config files
as a corolary, invalid option are no more loaded
parent
ce07794a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/is
+5
-6
5 additions, 6 deletions
bin/is
installsystems/config.py
+15
-1
15 additions, 1 deletion
installsystems/config.py
with
20 additions
and
7 deletions
bin/is
+
5
−
6
View file @
2761c8fc
...
...
@@ -38,7 +38,6 @@ def load_repositories(args):
if
args
.
repo_path
is
not
None
:
repoman
.
register
(
RepositoryConfig
(
istools
.
smd5sum
(
args
.
repo_path
)[:
8
],
path
=
args
.
repo_path
))
# load repo configs from config
for
repoconf
in
RepoConfigFile
(
args
.
repo_config
).
repos
:
repoman
.
register
(
repoconf
)
...
...
@@ -302,9 +301,9 @@ p_main.add_argument("-V", "--version", action="version",
help
=
"
show installsystems version
"
)
# exclusive group on debug/quiet
ex_group
=
p_main
.
add_mutually_exclusive_group
()
ex_group
.
add_argument
(
"
-d
"
,
"
--debug
"
,
action
=
"
store_true
"
,
ex_group
.
add_argument
(
"
-d
"
,
"
--debug
"
,
action
=
"
store_true
"
,
default
=
None
,
help
=
"
active debug mode
"
)
ex_group
.
add_argument
(
"
-q
"
,
"
--quiet
"
,
action
=
"
store_true
"
,
ex_group
.
add_argument
(
"
-q
"
,
"
--quiet
"
,
action
=
"
store_true
"
,
default
=
None
,
help
=
"
active quiet mode
"
)
# common options
p_main
.
add_argument
(
"
-c
"
,
"
--config
"
,
default
=
"
installsystems
"
,
...
...
@@ -317,11 +316,11 @@ p_main.add_argument("-r", "--repo-path", default=None,
help
=
"
repository path
"
)
p_main
.
add_argument
(
"
-C
"
,
"
--cache
"
,
default
=
None
,
help
=
"
path of the repository cache
"
)
p_main
.
add_argument
(
"
--no-cache
"
,
action
=
"
store_true
"
,
default
=
Fals
e
,
p_main
.
add_argument
(
"
--no-cache
"
,
action
=
"
store_true
"
,
default
=
Non
e
,
help
=
"
not use persistent db caching
"
)
p_main
.
add_argument
(
"
--no-color
"
,
action
=
"
store_true
"
,
default
=
Fals
e
,
p_main
.
add_argument
(
"
--no-color
"
,
action
=
"
store_true
"
,
default
=
Non
e
,
help
=
"
dot not display colored output
"
)
p_main
.
add_argument
(
"
-t
"
,
"
--timeout
"
,
dest
=
"
timeout
"
,
type
=
int
,
default
=
3
,
p_main
.
add_argument
(
"
-t
"
,
"
--timeout
"
,
dest
=
"
timeout
"
,
type
=
int
,
default
=
None
,
help
=
"
download timeout (default 3)
"
)
# create a subparsers for each command
...
...
This diff is collapsed.
Click to expand it.
installsystems/config.py
+
15
−
1
View file @
2761c8fc
...
...
@@ -84,7 +84,21 @@ class MainConfigFile(ConfigFile):
if
not
hasattr
(
namespace
,
option
):
setattr
(
namespace
,
option
,
value
)
elif
getattr
(
namespace
,
option
)
==
None
:
setattr
(
namespace
,
option
,
value
)
# we need to handle boolean differently
if
option
in
(
"
debug
"
,
"
quiet
"
,
"
no_cache
"
,
"
no_color
"
):
setattr
(
namespace
,
option
,
value
.
lower
()
not
in
(
"
false
"
,
"
no
"
,
"
0
"
))
# we need to handle integer differently
elif
option
in
(
"
timeout
"
):
try
:
n
=
int
(
value
)
except
ValueError
:
raise
Exception
(
"
Invalid %s: Not a number
"
%
option
)
setattr
(
namespace
,
option
,
n
)
# we can handle string more carefuly
elif
option
in
(
"
cache
"
,
"
repo_filter
"
,
"
repo_config
"
):
setattr
(
namespace
,
option
,
value
)
else
:
warn
(
"
Invalid option %s in %s, skipped
"
%
(
option
,
self
.
path
))
def
_cache_paths
(
self
):
'''
...
...
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