Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
slapos.core
Commits
559dfa4f
Commit
559dfa4f
authored
Apr 25, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exception cleanup: 'as exc'
parent
4bf79b18
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+31
-31
No files found.
slapos/grid/slapgrid.py
View file @
559dfa4f
...
@@ -528,8 +528,8 @@ class Slapgrid(object):
...
@@ -528,8 +528,8 @@ class Slapgrid(object):
def
getComputerPartitionList
(
self
):
def
getComputerPartitionList
(
self
):
try
:
try
:
return
self
.
computer
.
getComputerPartitionList
()
return
self
.
computer
.
getComputerPartitionList
()
except
socket
.
error
as
e
rror
:
except
socket
.
error
as
e
xc
:
self
.
logger
.
fatal
(
e
rror
)
self
.
logger
.
fatal
(
e
xc
)
raise
raise
def
processSoftwareReleaseList
(
self
):
def
processSoftwareReleaseList
(
self
):
...
@@ -589,10 +589,10 @@ class Slapgrid(object):
...
@@ -589,10 +589,10 @@ class Slapgrid(object):
raise
raise
# Buildout failed: send log but don't print it to output (already done)
# Buildout failed: send log but don't print it to output (already done)
except
BuildoutFailedError
as
exc
eption
:
except
BuildoutFailedError
as
exc
:
clean_run
=
False
clean_run
=
False
try
:
try
:
software_release
.
error
(
exc
eption
)
software_release
.
error
(
exc
)
except
(
SystemExit
,
KeyboardInterrupt
):
except
(
SystemExit
,
KeyboardInterrupt
):
raise
raise
except
Exception
:
except
Exception
:
...
@@ -601,9 +601,9 @@ class Slapgrid(object):
...
@@ -601,9 +601,9 @@ class Slapgrid(object):
# For everything else: log it, send it, continue.
# For everything else: log it, send it, continue.
except
Exception
:
except
Exception
:
exc
eption
=
traceback
.
format_exc
()
exc
=
traceback
.
format_exc
()
logger
.
error
(
exc
eption
)
logger
.
error
(
exc
)
software_release
.
error
(
exc
eption
)
software_release
.
error
(
exc
)
clean_run
=
False
clean_run
=
False
else
:
else
:
if
state
==
'available'
:
if
state
==
'available'
:
...
@@ -862,9 +862,9 @@ class Slapgrid(object):
...
@@ -862,9 +862,9 @@ class Slapgrid(object):
raise
raise
# Buildout failed: send log but don't print it to output (already done)
# Buildout failed: send log but don't print it to output (already done)
except
BuildoutFailedError
as
exc
eption
:
except
BuildoutFailedError
as
exc
:
try
:
try
:
computer_partition
.
error
(
exc
eption
)
computer_partition
.
error
(
exc
)
except
(
SystemExit
,
KeyboardInterrupt
):
except
(
SystemExit
,
KeyboardInterrupt
):
raise
raise
except
Exception
:
except
Exception
:
...
@@ -872,10 +872,10 @@ class Slapgrid(object):
...
@@ -872,10 +872,10 @@ class Slapgrid(object):
traceback
.
format_exc
())
traceback
.
format_exc
())
# For everything else: log it, send it, continue.
# For everything else: log it, send it, continue.
except
Exception
as
exc
eption
:
except
Exception
as
exc
:
logger
.
error
(
traceback
.
format_exc
())
logger
.
error
(
traceback
.
format_exc
())
try
:
try
:
computer_partition
.
error
(
exc
eption
)
computer_partition
.
error
(
exc
)
except
(
SystemExit
,
KeyboardInterrupt
):
except
(
SystemExit
,
KeyboardInterrupt
):
raise
raise
except
Exception
:
except
Exception
:
...
@@ -916,11 +916,11 @@ class Slapgrid(object):
...
@@ -916,11 +916,11 @@ class Slapgrid(object):
computer_partition
.
error
(
traceback
.
format_exc
())
computer_partition
.
error
(
traceback
.
format_exc
())
raise
raise
except
Slapgrid
.
PromiseError
as
exc
eption
:
except
Slapgrid
.
PromiseError
as
exc
:
clean_run_promise
=
False
clean_run_promise
=
False
try
:
try
:
logger
.
error
(
exc
eption
)
logger
.
error
(
exc
)
computer_partition
.
error
(
exc
eption
)
computer_partition
.
error
(
exc
)
except
(
SystemExit
,
KeyboardInterrupt
):
except
(
SystemExit
,
KeyboardInterrupt
):
raise
raise
except
Exception
:
except
Exception
:
...
@@ -928,10 +928,10 @@ class Slapgrid(object):
...
@@ -928,10 +928,10 @@ class Slapgrid(object):
traceback
.
format_exc
())
traceback
.
format_exc
())
# Buildout failed: send log but don't print it to output (already done)
# Buildout failed: send log but don't print it to output (already done)
except
BuildoutFailedError
as
exc
eption
:
except
BuildoutFailedError
as
exc
:
clean_run
=
False
clean_run
=
False
try
:
try
:
computer_partition
.
error
(
exc
eption
)
computer_partition
.
error
(
exc
)
except
(
SystemExit
,
KeyboardInterrupt
):
except
(
SystemExit
,
KeyboardInterrupt
):
raise
raise
except
Exception
:
except
Exception
:
...
@@ -939,11 +939,11 @@ class Slapgrid(object):
...
@@ -939,11 +939,11 @@ class Slapgrid(object):
traceback
.
format_exc
())
traceback
.
format_exc
())
# For everything else: log it, send it, continue.
# For everything else: log it, send it, continue.
except
Exception
as
exc
eption
:
except
Exception
as
exc
:
clean_run
=
False
clean_run
=
False
logger
.
error
(
traceback
.
format_exc
())
logger
.
error
(
traceback
.
format_exc
())
try
:
try
:
computer_partition
.
error
(
exc
eption
)
computer_partition
.
error
(
exc
)
except
(
SystemExit
,
KeyboardInterrupt
):
except
(
SystemExit
,
KeyboardInterrupt
):
raise
raise
except
Exception
:
except
Exception
:
...
@@ -972,10 +972,10 @@ class Slapgrid(object):
...
@@ -972,10 +972,10 @@ class Slapgrid(object):
try
:
try
:
document
=
etree
.
fromstring
(
to_be_validated
)
document
=
etree
.
fromstring
(
to_be_validated
)
except
(
etree
.
XMLSyntaxError
,
etree
.
DocumentInvalid
)
as
e
:
except
(
etree
.
XMLSyntaxError
,
etree
.
DocumentInvalid
)
as
e
xc
:
logger
.
info
(
'Failed to parse this XML report : %s
\
n
%s'
%
\
logger
.
info
(
'Failed to parse this XML report : %s
\
n
%s'
%
\
(
to_be_validated
,
_formatXMLError
(
e
)))
(
to_be_validated
,
_formatXMLError
(
e
xc
)))
logger
.
error
(
_formatXMLError
(
e
))
logger
.
error
(
_formatXMLError
(
e
xc
))
return
False
return
False
if
xmlschema
.
validate
(
document
):
if
xmlschema
.
validate
(
document
):
...
@@ -1004,16 +1004,16 @@ class Slapgrid(object):
...
@@ -1004,16 +1004,16 @@ class Slapgrid(object):
for
computer_partition_usage
in
computer_partition_usage_list
:
for
computer_partition_usage
in
computer_partition_usage_list
:
try
:
try
:
root
=
etree
.
fromstring
(
computer_partition_usage
.
usage
)
root
=
etree
.
fromstring
(
computer_partition_usage
.
usage
)
except
UnicodeError
as
e
:
except
UnicodeError
as
e
xc
:
self
.
logger
.
info
(
"Failed to read %s."
%
computer_partition_usage
.
usage
)
self
.
logger
.
info
(
"Failed to read %s."
%
computer_partition_usage
.
usage
)
self
.
logger
.
error
(
UnicodeError
)
self
.
logger
.
error
(
UnicodeError
)
raise
UnicodeError
(
"Failed to read %s: %s"
%
(
computer_partition_usage
.
usage
,
e
))
raise
UnicodeError
(
"Failed to read %s: %s"
%
(
computer_partition_usage
.
usage
,
e
xc
))
except
(
etree
.
XMLSyntaxError
,
etree
.
DocumentInvalid
)
as
e
:
except
(
etree
.
XMLSyntaxError
,
etree
.
DocumentInvalid
)
as
e
xc
:
self
.
logger
.
info
(
"Failed to parse %s."
%
(
computer_partition_usage
.
usage
))
self
.
logger
.
info
(
"Failed to parse %s."
%
(
computer_partition_usage
.
usage
))
self
.
logger
.
error
(
e
)
self
.
logger
.
error
(
e
xc
)
raise
_formatXMLError
(
e
)
raise
_formatXMLError
(
e
xc
)
except
Exception
as
e
:
except
Exception
as
e
xc
:
raise
Exception
(
"Failed to generate XML report: %s"
%
e
)
raise
Exception
(
"Failed to generate XML report: %s"
%
e
xc
)
for
movement
in
root
.
findall
(
'movement'
):
for
movement
in
root
.
findall
(
'movement'
):
xml
.
append
(
'<movement>'
)
xml
.
append
(
'<movement>'
)
...
@@ -1246,9 +1246,9 @@ class Slapgrid(object):
...
@@ -1246,9 +1246,9 @@ class Slapgrid(object):
raise
raise
except
Exception
:
except
Exception
:
clean_run
=
False
clean_run
=
False
exc
eption
=
traceback
.
format_exc
()
exc
=
traceback
.
format_exc
()
computer_partition
.
error
(
exc
eption
)
computer_partition
.
error
(
exc
)
logger
.
error
(
exc
eption
)
logger
.
error
(
exc
)
try
:
try
:
computer_partition
.
destroyed
()
computer_partition
.
destroyed
()
except
NotFoundError
:
except
NotFoundError
:
...
...
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