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
e2e521d0
Commit
e2e521d0
authored
17 years ago
by
Iustin Pop
Browse files
Options
Downloads
Patches
Plain Diff
Small cleanup for error formatting
Reviewed-by: ultrotter
parent
c7b46d59
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
lib/cli.py
+10
-9
10 additions, 9 deletions
lib/cli.py
with
10 additions
and
9 deletions
lib/cli.py
+
10
−
9
View file @
e2e521d0
...
@@ -370,10 +370,11 @@ def FormatError(err):
...
@@ -370,10 +370,11 @@ def FormatError(err):
"""
"""
retcode
=
1
retcode
=
1
obuf
=
StringIO
()
obuf
=
StringIO
()
msg
=
str
(
err
)
if
isinstance
(
err
,
errors
.
ConfigurationError
):
if
isinstance
(
err
,
errors
.
ConfigurationError
):
msg
=
"
Corrupt configuration file: %s
"
%
err
txt
=
"
Corrupt configuration file: %s
"
%
msg
logger
.
Error
(
msg
)
logger
.
Error
(
txt
)
obuf
.
write
(
msg
+
"
\n
"
)
obuf
.
write
(
txt
+
"
\n
"
)
obuf
.
write
(
"
Aborting.
"
)
obuf
.
write
(
"
Aborting.
"
)
retcode
=
2
retcode
=
2
elif
isinstance
(
err
,
errors
.
HooksAbort
):
elif
isinstance
(
err
,
errors
.
HooksAbort
):
...
@@ -386,7 +387,7 @@ def FormatError(err):
...
@@ -386,7 +387,7 @@ def FormatError(err):
obuf
.
write
(
"
node: %s, script: %s (no output)
\n
"
%
obuf
.
write
(
"
node: %s, script: %s (no output)
\n
"
%
(
node
,
script
))
(
node
,
script
))
elif
isinstance
(
err
,
errors
.
HooksFailure
):
elif
isinstance
(
err
,
errors
.
HooksFailure
):
obuf
.
write
(
"
Failure: hooks general failure: %s
"
%
str
(
err
)
)
obuf
.
write
(
"
Failure: hooks general failure: %s
"
%
msg
)
elif
isinstance
(
err
,
errors
.
ResolverError
):
elif
isinstance
(
err
,
errors
.
ResolverError
):
this_host
=
utils
.
HostInfo
.
SysName
()
this_host
=
utils
.
HostInfo
.
SysName
()
if
err
.
args
[
0
]
==
this_host
:
if
err
.
args
[
0
]
==
this_host
:
...
@@ -396,15 +397,15 @@ def FormatError(err):
...
@@ -396,15 +397,15 @@ def FormatError(err):
obuf
.
write
(
msg
%
err
.
args
[
0
])
obuf
.
write
(
msg
%
err
.
args
[
0
])
elif
isinstance
(
err
,
errors
.
OpPrereqError
):
elif
isinstance
(
err
,
errors
.
OpPrereqError
):
obuf
.
write
(
"
Failure: prerequisites not met for this
"
obuf
.
write
(
"
Failure: prerequisites not met for this
"
"
operation:
\n
%s
"
%
str
(
err
)
)
"
operation:
\n
%s
"
%
msg
)
elif
isinstance
(
err
,
errors
.
OpExecError
):
elif
isinstance
(
err
,
errors
.
OpExecError
):
obuf
.
write
(
"
Failure: command execution error:
\n
%s
"
%
str
(
err
)
)
obuf
.
write
(
"
Failure: command execution error:
\n
%s
"
%
msg
)
elif
isinstance
(
err
,
errors
.
TagError
):
elif
isinstance
(
err
,
errors
.
TagError
):
obuf
.
write
(
"
Failure: invalid tag(s) given:
\n
%s
"
%
str
(
err
)
)
obuf
.
write
(
"
Failure: invalid tag(s) given:
\n
%s
"
%
msg
)
elif
isinstance
(
err
,
errors
.
GenericError
):
elif
isinstance
(
err
,
errors
.
GenericError
):
obuf
.
write
(
"
Unhandled Ganeti error: %s
"
%
str
(
err
)
)
obuf
.
write
(
"
Unhandled Ganeti error: %s
"
%
msg
)
else
:
else
:
obuf
.
write
(
"
Unhandled exception: %s
"
%
str
(
err
)
)
obuf
.
write
(
"
Unhandled exception: %s
"
%
msg
)
return
retcode
,
obuf
.
getvalue
().
rstrip
(
'
\n
'
)
return
retcode
,
obuf
.
getvalue
().
rstrip
(
'
\n
'
)
...
...
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