Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-ganeti
Commits
eda37a5a
Commit
eda37a5a
authored
Jun 23, 2008
by
Michael Hanselmann
Browse files
cfgupgrade: Add logging module
Reviewed-by: iustinp
parent
740c5aab
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/cfgupgrade
View file @
eda37a5a
...
...
@@ -33,6 +33,7 @@ import sys
import
optparse
import
tempfile
import
simplejson
import
logging
from
ganeti
import
utils
from
ganeti
import
cli
...
...
@@ -104,6 +105,26 @@ def UpdateFromVersion2To3(cfg):
cfg
[
'cluster'
][
'config_version'
]
=
3
def
SetupLogging
():
"""Configures the logging module.
"""
formatter
=
logging
.
Formatter
(
"%(asctime)s: %(message)s"
)
stderr_handler
=
logging
.
StreamHandler
()
stderr_handler
.
setFormatter
(
formatter
)
if
options
.
debug
:
stderr_handler
.
setLevel
(
logging
.
NOTSET
)
elif
options
.
verbose
:
stderr_handler
.
setLevel
(
logging
.
INFO
)
else
:
stderr_handler
.
setLevel
(
logging
.
CRITICAL
)
root_logger
=
logging
.
getLogger
(
""
)
root_logger
.
setLevel
(
logging
.
NOTSET
)
root_logger
.
addHandler
(
stderr_handler
)
# Main program
if
__name__
==
"__main__"
:
program
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
...
...
@@ -115,11 +136,14 @@ if __name__ == "__main__":
help
=
"Try to do the conversion, but don't write"
" output file"
)
parser
.
add_option
(
cli
.
FORCE_OPT
)
parser
.
add_option
(
cli
.
DEBUG_OPT
)
parser
.
add_option
(
'--verbose'
,
dest
=
'verbose'
,
action
=
"store_true"
,
help
=
"Verbose output"
)
(
options
,
args
)
=
parser
.
parse_args
()
SetupLogging
()
# Option checking
if
args
:
cfg_file
=
args
[
0
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment