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
18
Merge Requests
18
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
956feb77
Commit
956feb77
authored
Feb 01, 2023
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapgrid: Move to new allDocs structure and use get_parameters
parent
66912dd6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
21 deletions
+52
-21
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+4
-16
slapos/tests/test_slapgrid.py
slapos/tests/test_slapgrid.py
+48
-5
No files found.
slapos/grid/slapgrid.py
View file @
956feb77
...
...
@@ -1127,10 +1127,7 @@ stderr_logfile_backups=1
}).
get
(
"result_list"
,
[])
for
instance_result
in
related_instance_list
:
if
instance_result
[
"reference"
]
!=
computer_partition
[
"reference"
]:
instance
=
self
.
slap
.
jio_api_connector
.
get
({
"portal_type"
:
"Software Instance"
,
"reference"
:
instance_result
[
"reference"
],
})
instance
=
self
.
slap
.
jio_api_connector
.
get
(
instance_result
[
"get_parameters"
])
hosting_ip_list
=
hosting_ip_list
+
instance
[
"ip_list"
]
else
:
hosting_ip_list
=
computer_partition
[
"slap_partition"
].
getFullHostingIpAddressList
()
...
...
@@ -1609,10 +1606,7 @@ stderr_logfile_backups=1
# even if something is terribly wrong while processing an instance, it
# won't prevent processing other ones.
if
not
self
.
api_backward_compatibility
:
computer_partition
=
self
.
slap
.
jio_api_connector
.
get
({
"portal_type"
:
"Software Instance"
,
"reference"
:
computer_partition
[
"reference"
]
})
computer_partition
=
self
.
slap
.
jio_api_connector
.
get
(
computer_partition
[
"get_parameters"
])
try
:
# Process the partition itself
self
.
processComputerPartition
(
computer_partition
)
...
...
@@ -1685,10 +1679,7 @@ stderr_logfile_backups=1
promise_error_partition_list
=
[]
for
computer_partition
in
computer_partition_list
:
if
not
self
.
api_backward_compatibility
:
computer_partition
=
self
.
slap
.
jio_api_connector
.
get
({
"portal_type"
:
"Software Instance"
,
"reference"
:
computer_partition
[
"reference"
]
})
computer_partition
=
self
.
slap
.
jio_api_connector
.
get
(
computer_partition
[
"get_parameters"
])
try
:
# Process the partition itself
self
.
processPromise
(
computer_partition
)
...
...
@@ -2001,10 +1992,7 @@ stderr_logfile_backups=1
software_path
=
None
if
not
self
.
api_backward_compatibility
:
computer_partition
=
self
.
slap
.
jio_api_connector
.
get
({
"portal_type"
:
"Software Instance"
,
"reference"
:
computer_partition
[
"reference"
]
})
computer_partition
=
self
.
slap
.
jio_api_connector
.
get
(
computer_partition
[
"get_parameters"
])
local_partition
=
Partition
(
software_path
=
software_path
,
...
...
slapos/tests/test_slapgrid.py
View file @
956feb77
...
...
@@ -442,46 +442,85 @@ class ComputerForTest(object):
if
(
url
.
path
==
'/api/allDocs/'
):
if
content
[
"portal_type"
]
==
"Software Installation"
:
return
json
.
dumps
({
"current_page_full"
:
False
,
"next_page_request"
:
{
"portal_type"
:
"Software Installation"
,
"compute_node_id"
:
content
[
"compute_node_id"
],
},
"result_list"
:
[{
"software_release_uri"
:
x
.
name
,
"portal_type"
:
"Software Installation"
,
"compute_node_id"
:
content
[
"compute_node_id"
],
"state"
:
x
.
requested_state
"state"
:
x
.
requested_state
,
"api_revision"
:
"12121"
,
"get_parameters"
:
{
"software_release_uri"
:
x
.
name
,
"portal_type"
:
"Software Installation"
,
"compute_node_id"
:
content
[
"compute_node_id"
],
}
}
for
x
in
self
.
software_list
]
})
if
content
[
"portal_type"
]
==
"Software Instance"
:
if
"compute_node_id"
in
content
:
if
"compute_partition_id"
in
content
:
return
json
.
dumps
({
"current_page_full"
:
False
,
"next_page_request"
:
{
"portal_type"
:
"Software Instance"
,
"compute_partition_id"
:
content
[
"compute_partition_id"
],
},
"result_list"
:
[{
"software_release_uri"
:
x
.
software
.
name
if
x
.
software
else
None
,
"reference"
:
x
.
name
,
"title"
:
x
.
name
,
"portal_type"
:
"Software Instance"
,
"compute_partition_id"
:
x
.
name
,
"state"
:
x
.
requested_state
"state"
:
x
.
requested_state
,
"api_revision"
:
"12132"
,
"get_parameters"
:
{
"portal_type"
:
"Software Instance"
,
"reference"
:
x
.
name
,
}
}
for
x
in
self
.
instance_list
if
x
.
name
==
content
[
"compute_partition_id"
]]
})
else
:
return
json
.
dumps
({
"current_page_full"
:
False
,
"next_page_request"
:
{
"portal_type"
:
"Software Instance"
,
"compute_node_id"
:
content
[
"compute_node_id"
],
},
"result_list"
:
[{
"software_release_uri"
:
x
.
software
.
name
if
x
.
software
else
None
,
"reference"
:
x
.
name
,
"title"
:
x
.
name
,
"portal_type"
:
"Software Instance"
,
"compute_partition_id"
:
x
.
name
,
"state"
:
x
.
requested_state
"state"
:
x
.
requested_state
,
"get_parameters"
:
{
"portal_type"
:
"Software Instance"
,
"reference"
:
x
.
name
,
}
}
for
x
in
self
.
instance_list
]
})
elif
"root_instance_title"
in
content
:
return
json
.
dumps
({
"current_page_full"
:
False
,
"next_page_request"
:
{
"portal_type"
:
"Software Instance"
,
"root_instance_title"
:
content
[
"root_instance_title"
],
},
"result_list"
:
[{
"software_release_uri"
:
x
.
software
.
name
if
x
.
software
else
None
,
"reference"
:
x
.
name
,
"title"
:
x
.
name
,
"portal_type"
:
"Software Instance"
,
"compute_partition_id"
:
x
.
name
,
"state"
:
x
.
requested_state
"state"
:
x
.
requested_state
,
"get_parameters"
:
{
"portal_type"
:
"Software Instance"
,
"reference"
:
x
.
name
,
},
}
for
x
in
self
.
instance_list
]
+
[
{
"software_release_uri"
:
"foo.cfg"
,
...
...
@@ -489,7 +528,11 @@ class ComputerForTest(object):
"title"
:
"related_instance"
,
"portal_type"
:
"Software Instance"
,
"compute_partition_id"
:
"related_instance"
,
"state"
:
"stopped"
"state"
:
"stopped"
,
"get_parameters"
:
{
"portal_type"
:
"Software Instance"
,
"reference"
:
"related_instance"
,
}
}
]
})
...
...
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