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
Cédric Le Ninivin
slapos.core
Commits
35e3ff03
Commit
35e3ff03
authored
Aug 09, 2022
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip slapgrid tests are passing with new API
parent
cb36a56e
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
18 deletions
+77
-18
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+1
-1
slapos/manager/portredir.py
slapos/manager/portredir.py
+1
-2
slapos/slap/slap.py
slapos/slap/slap.py
+31
-1
slapos/tests/test_slapgrid.py
slapos/tests/test_slapgrid.py
+44
-14
No files found.
slapos/grid/slapgrid.py
View file @
35e3ff03
...
@@ -574,7 +574,7 @@ stderr_logfile_backups=1
...
@@ -574,7 +574,7 @@ stderr_logfile_backups=1
"portal_type"
:
"Software Instance"
,
"portal_type"
:
"Software Instance"
,
"compute_partition_id"
:
partition
.
getId
(),
"compute_partition_id"
:
partition
.
getId
(),
"state"
:
partition
.
getState
(),
"state"
:
partition
.
getState
(),
"software_type"
:
self
.
getInstanceParameterDict
().
get
(
"software_type"
:
partition
.
getInstanceParameterDict
().
get
(
'slap_software_type'
,
None
),
'slap_software_type'
,
None
),
"parameters"
:
partition
.
getInstanceParameterDict
(),
"parameters"
:
partition
.
getInstanceParameterDict
(),
"instance_processing_timestamp"
:
partition
.
getInstanceParameterDict
().
get
(
"instance_processing_timestamp"
:
partition
.
getInstanceParameterDict
().
get
(
...
...
slapos/manager/portredir.py
View file @
35e3ff03
...
@@ -82,9 +82,8 @@ class Manager(object):
...
@@ -82,9 +82,8 @@ class Manager(object):
# Get partitions IPv6 address
# Get partitions IPv6 address
computer_partition
=
partition
.
computer_partition
computer_partition
=
partition
.
computer_partition
parameter_dict
=
computer_partition
.
getInstanceParameterDict
()
partition_ip_list
=
parameter_dict
[
'ip_list'
]
+
parameter_dict
.
get
(
partition_ip_list
=
computer_partition
[
'ip_list'
]
+
computer_partition
.
get
(
'full_ip_list'
,
[])
'full_ip_list'
,
[])
partition_ip_list
=
[
tup
[
1
]
for
tup
in
partition_ip_list
]
partition_ip_list
=
[
tup
[
1
]
for
tup
in
partition_ip_list
]
...
...
slapos/slap/slap.py
View file @
35e3ff03
...
@@ -719,6 +719,36 @@ class SlapConnectionHelper(ConnectionHelper):
...
@@ -719,6 +719,36 @@ class SlapConnectionHelper(ConnectionHelper):
return
loads
(
xml
)
return
loads
(
xml
)
# https://stackoverflow.com/a/33571117
def
_byteify
(
data
,
ignore_dicts
=
False
):
if
isinstance
(
data
,
str
):
return
data
# if this is a list of values, return list of byteified values
if
isinstance
(
data
,
list
):
return
[
_byteify
(
item
,
ignore_dicts
=
True
)
for
item
in
data
]
# if this is a dictionary, return dictionary of byteified keys and values
# but only if we haven't already byteified it
if
isinstance
(
data
,
dict
)
and
not
ignore_dicts
:
return
{
_byteify
(
key
,
ignore_dicts
=
True
):
_byteify
(
value
,
ignore_dicts
=
True
)
for
key
,
value
in
data
.
items
()
# changed to .items() for python 2.7/3
}
# python 3 compatible duck-typing
# if this is a unicode string, return its string representation
if
str
(
type
(
data
))
==
"<type 'unicode'>"
:
return
data
.
encode
(
'utf-8'
)
# if it's anything else, return it in its original form
return
data
def
json_loads_byteified
(
json_text
):
return
_byteify
(
json
.
loads
(
json_text
,
object_hook
=
_byteify
),
ignore_dicts
=
True
)
class
JioAPIConnectionHelper
(
ConnectionHelper
):
class
JioAPIConnectionHelper
(
ConnectionHelper
):
def
apiCall
(
self
,
path
,
data
):
def
apiCall
(
self
,
path
,
data
):
...
@@ -727,7 +757,7 @@ class JioAPIConnectionHelper(ConnectionHelper):
...
@@ -727,7 +757,7 @@ class JioAPIConnectionHelper(ConnectionHelper):
data
=
json
.
dumps
(
data
),
data
=
json
.
dumps
(
data
),
headers
=
{
'Content-type'
:
'application/json'
},
headers
=
{
'Content-type'
:
'application/json'
},
expect_json_error
=
True
)
expect_json_error
=
True
)
return
req
.
json
(
)
return
json_loads_byteified
(
req
.
text
)
def
get
(
self
,
data
):
def
get
(
self
,
data
):
return
self
.
apiCall
(
path
=
"get/"
,
return
self
.
apiCall
(
path
=
"get/"
,
...
...
slapos/tests/test_slapgrid.py
View file @
35e3ff03
This diff is collapsed.
Click to expand it.
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