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
Eric Zheng
slapos.core
Commits
2f34172d
Commit
2f34172d
authored
Jun 06, 2017
by
Tomáš Peterka
Committed by
Rafael Monnerat
Jun 06, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[proxy] Fix implementation of getRootPartition to return root partition instead of None
parent
aad13817
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
slapos/proxy/views.py
slapos/proxy/views.py
+12
-8
No files found.
slapos/proxy/views.py
View file @
2f34172d
...
@@ -554,17 +554,21 @@ def getAllocatedSlaveInstance(slave_reference, requested_computer_id):
...
@@ -554,17 +554,21 @@ def getAllocatedSlaveInstance(slave_reference, requested_computer_id):
return
execute_db
(
table
,
q
,
args
,
one
=
True
)
return
execute_db
(
table
,
q
,
args
,
one
=
True
)
def
getRootPartition
(
reference
):
def
getRootPartition
(
reference
):
"""Climb the partitions tree up by 'requested_by' link to get the root partition."""
p
=
'SELECT * FROM %s WHERE reference=?'
p
=
'SELECT * FROM %s WHERE reference=?'
partition
=
execute_db
(
'partition'
,
p
,
[
reference
],
one
=
True
)
assert
partition
is
not
None
,
"Nonexisting partition
\
"
{}
\
"
. Known
\
n
{!s}"
.
format
(
reference
,
execute_db
(
"partition"
,
"select reference, requested_by from %s"
))
parent_partition
=
execute_db
(
'partition'
,
p
,
[
partition
[
'requested_by'
]],
one
=
True
)
while
(
parent_partition
is
not
None
and
parent_partition
[
'requested_by'
]
and
parent_partition
[
'requested_by'
]
!=
reference
):
partition
=
parent_partition
reference
=
parent_partition
[
'requested_by'
]
parent_partition
=
execute_db
(
'partition'
,
p
,
[
reference
],
one
=
True
)
parent_partition
=
execute_db
(
'partition'
,
p
,
[
reference
],
one
=
True
)
while
parent_partition
is
not
None
:
return
partition
parent_reference
=
parent_partition
[
'requested_by'
]
if
not
parent_reference
or
parent_reference
==
reference
:
break
reference
=
parent_reference
parent_partition
=
execute_db
(
'partition'
,
p
,
[
reference
],
one
=
True
)
return
parent_partition
def
requestNotSlave
(
software_release
,
software_type
,
partition_reference
,
partition_id
,
partition_parameter_kw
,
filter_kw
,
requested_state
):
def
requestNotSlave
(
software_release
,
software_type
,
partition_reference
,
partition_id
,
partition_parameter_kw
,
filter_kw
,
requested_state
):
instance_xml
=
dict2xml
(
partition_parameter_kw
)
instance_xml
=
dict2xml
(
partition_parameter_kw
)
...
...
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