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
Labels
Merge Requests
23
Merge Requests
23
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
5fad6316
Commit
5fad6316
authored
Sep 20, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure getComputerInformation is not called if NotFound.
Just doing it by factoring code.
parent
fa66e9d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
11 deletions
+9
-11
slapos/slap/slap.py
slapos/slap/slap.py
+9
-11
No files found.
slapos/slap/slap.py
View file @
5fad6316
...
...
@@ -227,12 +227,7 @@ def _syncComputerInformation(func):
def
decorated
(
self
,
*
args
,
**
kw
):
if
getattr
(
self
,
'_synced'
,
0
):
return
func
(
self
,
*
args
,
**
kw
)
# XXX: This is a ugly way to keep backward compatibility,
# We should stablise slap library soon.
try
:
computer
=
self
.
_connection_helper
.
getFullComputerInformation
(
self
.
_computer_id
)
except
NotFoundError
:
computer
=
self
.
_connection_helper
.
getComputerInformation
(
self
.
_computer_id
)
computer
=
self
.
_connection_helper
.
getFullComputerInformation
(
self
.
_computer_id
)
for
key
,
value
in
computer
.
__dict__
.
items
():
if
isinstance
(
value
,
unicode
):
# convert unicode to utf-8
...
...
@@ -300,10 +295,7 @@ def _syncComputerPartitionInformation(func):
return
func
(
self
,
*
args
,
**
kw
)
# XXX: This is a ugly way to keep backward compatibility,
# We should stablise slap library soon.
try
:
computer
=
self
.
_connection_helper
.
getFullComputerInformation
(
self
.
_computer_id
)
except
NotFoundError
:
computer
=
self
.
_connection_helper
.
getComputerInformation
(
self
.
_computer_id
)
computer
=
self
.
_connection_helper
.
getFullComputerInformation
(
self
.
_computer_id
)
found_computer_partition
=
None
for
computer_partition
in
computer
.
_computer_partition_list
:
if
computer_partition
.
getId
()
==
self
.
getId
():
...
...
@@ -561,7 +553,13 @@ class ConnectionHelper:
if
not
computer_id
:
# XXX-Cedric: should raise something smarter than "NotFound".
raise
NotFoundError
(
method
)
self
.
GET
(
method
)
try
:
self
.
GET
(
method
)
except
NotFoundError
:
# XXX: This is a ugly way to keep backward compatibility,
# We should stablise slap library soon.
self
.
GET
(
'/getComputerInformation?computer_id=%s'
%
computer_id
)
return
xml_marshaller
.
loads
(
self
.
response
.
read
())
def
connect
(
self
):
...
...
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