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
Lu Xu
slapos.core
Commits
89e63a44
Commit
89e63a44
authored
Mar 24, 2023
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli/info: Include software-type in output
parent
bfe6284c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
1 deletion
+11
-1
slapos/cli/info.py
slapos/cli/info.py
+1
-0
slapos/proxy/views.py
slapos/proxy/views.py
+5
-0
slapos/tests/test_cli.py
slapos/tests/test_cli.py
+2
-0
slapos/tests/test_slapproxy.py
slapos/tests/test_slapproxy.py
+3
-1
No files found.
slapos/cli/info.py
View file @
89e63a44
...
@@ -105,6 +105,7 @@ def do_info(logger, conf, local):
...
@@ -105,6 +105,7 @@ def do_info(logger, conf, local):
info
=
{
info
=
{
'software-url'
:
instance
.
_software_release_url
,
'software-url'
:
instance
.
_software_release_url
,
'software-type'
:
instance
.
_source_reference
,
'requested-state'
:
instance
.
_requested_state
,
'requested-state'
:
instance
.
_requested_state
,
'instance-parameters'
:
instance
.
_parameter_dict
,
'instance-parameters'
:
instance
.
_parameter_dict
,
'connection-parameters'
:
connection_parameter_dict
,
'connection-parameters'
:
connection_parameter_dict
,
...
...
slapos/proxy/views.py
View file @
89e63a44
...
@@ -1118,6 +1118,11 @@ def hateoas_partitions(partition_reference):
...
@@ -1118,6 +1118,11 @@ def hateoas_partitions(partition_reference):
'key'
:
'software_release'
,
'key'
:
'software_release'
,
'default'
:
partition
[
'software_release'
],
'default'
:
partition
[
'software_release'
],
},
},
'my_source_reference'
:
{
'type'
:
'StringField'
,
'key'
:
'software_type'
,
'default'
:
partition
[
'software_type'
],
},
},
},
},
},
'_links'
:
{
'_links'
:
{
...
...
slapos/tests/test_cli.py
View file @
89e63a44
...
@@ -662,6 +662,7 @@ class TestCliInfo(CliMixin):
...
@@ -662,6 +662,7 @@ class TestCliInfo(CliMixin):
conn_params
=
'<instance>
\
n
<parameter id="_">%s</parameter>
\
n
</instance>'
%
json
.
dumps
(
conn
)
conn_params
=
'<instance>
\
n
<parameter id="_">%s</parameter>
\
n
</instance>'
%
json
.
dumps
(
conn
)
instance
=
slapos
.
slap
.
SoftwareInstance
(
instance
=
slapos
.
slap
.
SoftwareInstance
(
_software_release_url
=
'SR1'
,
_software_release_url
=
'SR1'
,
_source_reference
=
'mytype'
,
_requested_state
=
'mystate'
,
_requested_state
=
'mystate'
,
_connection_dict
=
conn_params
,
_connection_dict
=
conn_params
,
_parameter_dict
=
{
'myinstanceparameter'
:
'value2'
})
_parameter_dict
=
{
'myinstanceparameter'
:
'value2'
})
...
@@ -682,6 +683,7 @@ class TestCliInfo(CliMixin):
...
@@ -682,6 +683,7 @@ class TestCliInfo(CliMixin):
if
six
.
PY3
:
if
six
.
PY3
:
expected
=
{
expected
=
{
"software-url"
:
instance
.
_software_release_url
,
"software-url"
:
instance
.
_software_release_url
,
"software-type"
:
instance
.
_source_reference
,
"requested-state"
:
instance
.
_requested_state
,
"requested-state"
:
instance
.
_requested_state
,
"instance-parameters"
:
instance
.
_parameter_dict
,
"instance-parameters"
:
instance
.
_parameter_dict
,
"connection-parameters"
:
{
"connection-parameters"
:
{
...
...
slapos/tests/test_slapproxy.py
View file @
89e63a44
...
@@ -1291,13 +1291,14 @@ class TestCliInformation(CliMasterMixin):
...
@@ -1291,13 +1291,14 @@ class TestCliInformation(CliMasterMixin):
def
test_service_info
(
self
):
def
test_service_info
(
self
):
self
.
format_for_number_of_partitions
(
3
)
self
.
format_for_number_of_partitions
(
3
)
self
.
request
(
'http://sr0//'
,
None
,
'MyInstance0'
,
None
)
self
.
request
(
'http://sr0//'
,
None
,
'MyInstance0'
,
None
)
self
.
request
(
'http://sr1//'
,
None
,
'MyInstance1'
,
None
,
partition_parameter_kw
=
{
'couscous'
:
'hello'
})
self
.
request
(
'http://sr1//'
,
"MyType1"
,
'MyInstance1'
,
None
,
partition_parameter_kw
=
{
'couscous'
:
'hello'
})
self
.
request
(
'http://sr2//'
,
None
,
'MyInstance2'
,
'slappart0'
)
self
.
request
(
'http://sr2//'
,
None
,
'MyInstance2'
,
'slappart0'
)
output0
=
self
.
cliDoSlapos
((
'service'
,
'info'
,
'MyInstance0'
),
stderr
=
subprocess
.
DEVNULL
)
output0
=
self
.
cliDoSlapos
((
'service'
,
'info'
,
'MyInstance0'
),
stderr
=
subprocess
.
DEVNULL
)
self
.
assertEqual
(
self
.
assertEqual
(
json
.
loads
(
output0
),
json
.
loads
(
output0
),
{
{
"software-url"
:
"http://sr0//"
,
"software-url"
:
"http://sr0//"
,
"software-type"
:
"default"
,
"requested-state"
:
"started"
,
"requested-state"
:
"started"
,
"instance-parameters"
:
{},
"instance-parameters"
:
{},
"connection-parameters"
:
{},
"connection-parameters"
:
{},
...
@@ -1309,6 +1310,7 @@ class TestCliInformation(CliMasterMixin):
...
@@ -1309,6 +1310,7 @@ class TestCliInformation(CliMasterMixin):
json
.
loads
(
output1
),
json
.
loads
(
output1
),
{
{
"software-url"
:
"http://sr1//"
,
"software-url"
:
"http://sr1//"
,
"software-type"
:
"MyType1"
,
"requested-state"
:
"started"
,
"requested-state"
:
"started"
,
"instance-parameters"
:
{
"couscous"
:
"hello"
},
"instance-parameters"
:
{
"couscous"
:
"hello"
},
"connection-parameters"
:
{},
"connection-parameters"
:
{},
...
...
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