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
Boxiang Sun
slapos.core
Commits
47ff8c75
Commit
47ff8c75
authored
Apr 03, 2023
by
Thomas Gambier
🚴🏼
Browse files
Options
Browse Files
Download
Plain Diff
cli/info: Include software-type in output
See merge request
nexedi/slapos.core!505
parents
cd88f42e
1e61c969
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
6 deletions
+16
-6
slapos/cli/info.py
slapos/cli/info.py
+1
-0
slapos/proxy/views.py
slapos/proxy/views.py
+10
-5
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 @
47ff8c75
...
@@ -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 @
47ff8c75
...
@@ -1095,29 +1095,34 @@ def hateoas_partitions(partition_reference):
...
@@ -1095,29 +1095,34 @@ def hateoas_partitions(partition_reference):
},
},
'my_reference'
:
{
'my_reference'
:
{
'type'
:
'StringField'
,
'type'
:
'StringField'
,
'key'
:
'
partition
_reference'
,
'key'
:
'
field_my
_reference'
,
'default'
:
partition
[
'partition_reference'
],
'default'
:
partition
[
'partition_reference'
],
},
},
'my_slap_state'
:
{
'my_slap_state'
:
{
'type'
:
'StringField'
,
'type'
:
'StringField'
,
'key'
:
'slap_state'
,
'key'
:
'
field_my_
slap_state'
,
'default'
:
partition
[
'requested_state'
],
'default'
:
partition
[
'requested_state'
],
},
},
'my_text_content'
:
{
'my_text_content'
:
{
'type'
:
'StringField'
,
'type'
:
'StringField'
,
'key'
:
'
xml
'
,
'key'
:
'
field_my_text_content
'
,
'default'
:
partition
[
'xml'
],
'default'
:
partition
[
'xml'
],
},
},
'my_connection_parameter_list'
:
{
'my_connection_parameter_list'
:
{
'type'
:
'StringField'
,
'type'
:
'StringField'
,
'key'
:
'
connection_xml
'
,
'key'
:
'
field_my_connection_parameter_list
'
,
'default'
:
partition
[
'connection_xml'
],
'default'
:
partition
[
'connection_xml'
],
},
},
'my_url_string'
:
{
'my_url_string'
:
{
'type'
:
'StringField'
,
'type'
:
'StringField'
,
'key'
:
'
software_release
'
,
'key'
:
'
field_my_url_string
'
,
'default'
:
partition
[
'software_release'
],
'default'
:
partition
[
'software_release'
],
},
},
'my_source_reference'
:
{
'type'
:
'StringField'
,
'key'
:
'field_my_source_reference'
,
'default'
:
partition
[
'software_type'
],
},
},
},
},
},
'_links'
:
{
'_links'
:
{
...
...
slapos/tests/test_cli.py
View file @
47ff8c75
...
@@ -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 @
47ff8c75
...
@@ -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