Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snf-ganeti
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
itminedu
snf-ganeti
Commits
eda37a5a
Commit
eda37a5a
authored
16 years ago
by
Michael Hanselmann
Browse files
Options
Downloads
Patches
Plain Diff
cfgupgrade: Add logging module
Reviewed-by: iustinp
parent
740c5aab
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/cfgupgrade
+24
-0
24 additions, 0 deletions
tools/cfgupgrade
with
24 additions
and
0 deletions
tools/cfgupgrade
+
24
−
0
View file @
eda37a5a
...
@@ -33,6 +33,7 @@ import sys
...
@@ -33,6 +33,7 @@ import sys
import
optparse
import
optparse
import
tempfile
import
tempfile
import
simplejson
import
simplejson
import
logging
from
ganeti
import
utils
from
ganeti
import
utils
from
ganeti
import
cli
from
ganeti
import
cli
...
@@ -104,6 +105,26 @@ def UpdateFromVersion2To3(cfg):
...
@@ -104,6 +105,26 @@ def UpdateFromVersion2To3(cfg):
cfg
[
'
cluster
'
][
'
config_version
'
]
=
3
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
# Main program
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
program
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
program
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
...
@@ -115,11 +136,14 @@ if __name__ == "__main__":
...
@@ -115,11 +136,14 @@ if __name__ == "__main__":
help
=
"
Try to do the conversion, but don
'
t write
"
help
=
"
Try to do the conversion, but don
'
t write
"
"
output file
"
)
"
output file
"
)
parser
.
add_option
(
cli
.
FORCE_OPT
)
parser
.
add_option
(
cli
.
FORCE_OPT
)
parser
.
add_option
(
cli
.
DEBUG_OPT
)
parser
.
add_option
(
'
--verbose
'
,
dest
=
'
verbose
'
,
parser
.
add_option
(
'
--verbose
'
,
dest
=
'
verbose
'
,
action
=
"
store_true
"
,
action
=
"
store_true
"
,
help
=
"
Verbose output
"
)
help
=
"
Verbose output
"
)
(
options
,
args
)
=
parser
.
parse_args
()
(
options
,
args
)
=
parser
.
parse_args
()
SetupLogging
()
# Option checking
# Option checking
if
args
:
if
args
:
cfg_file
=
args
[
0
]
cfg_file
=
args
[
0
]
...
...
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