Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Ivan Tyagov
slapos
Commits
c61e5df3
Commit
c61e5df3
authored
Feb 16, 2021
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/theia: Add 'embedded-sr' option
See merge request
nexedi/slapos!913
parent
71644ca4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
1 deletion
+79
-1
software/theia/buildout.hash.cfg
software/theia/buildout.hash.cfg
+1
-1
software/theia/instance-input-schema.json
software/theia/instance-input-schema.json
+10
-0
software/theia/instance.cfg.in
software/theia/instance.cfg.in
+4
-0
software/theia/software.cfg
software/theia/software.cfg
+7
-0
software/theia/test/test.py
software/theia/test/test.py
+57
-0
No files found.
software/theia/buildout.hash.cfg
View file @
c61e5df3
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
[instance]
[instance]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
524c0b40d6ee49841fdbb2cf26fd1833
md5sum =
9a3142d6c43616b69217ea4979f25847
[yarn.lock]
[yarn.lock]
filename = yarn.lock
filename = yarn.lock
...
...
software/theia/instance-input-schema.json
View file @
c61e5df3
...
@@ -13,6 +13,16 @@
...
@@ -13,6 +13,16 @@
"disabled"
"disabled"
],
],
"default"
:
"running"
"default"
:
"running"
},
"embedded-sr"
:
{
"title"
:
"Embedded Software URL"
,
"description"
:
"Optional URL of a software to be embedded"
,
"type"
:
"string"
},
"embedded-sr-type"
:
{
"title"
:
"Embedded Software Type"
,
"description"
:
"Type of the optional embedded software"
,
"type"
:
"string"
}
}
}
}
}
}
software/theia/instance.cfg.in
View file @
c61e5df3
...
@@ -316,6 +316,8 @@ template =
...
@@ -316,6 +316,8 @@ template =
$${slapos-standalone-config:ipv6} \
$${slapos-standalone-config:ipv6} \
$${slapos-standalone-config:port} \
$${slapos-standalone-config:port} \
$${slapos-standalone-config:computer-id} \
$${slapos-standalone-config:computer-id} \
--sr='$${instance-parameter:configuration.embedded-sr}' \
--srtype='$${instance-parameter:configuration.embedded-sr-type}' \
$${slap-connection:server-url} \
$${slap-connection:server-url} \
$${slap-connection:computer-id} \
$${slap-connection:computer-id} \
$${slap-connection:partition-id} \
$${slap-connection:partition-id} \
...
@@ -404,6 +406,8 @@ url = $${slap-connection:server-url}
...
@@ -404,6 +406,8 @@ url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}
cert = $${slap-connection:cert-file}
configuration.autorun = running
configuration.autorun = running
configuration.embedded-sr =
configuration.embedded-sr-type =
[slapos-autorun]
[slapos-autorun]
recipe = plone.recipe.command
recipe = plone.recipe.command
...
...
software/theia/software.cfg
View file @
c61e5df3
...
@@ -71,6 +71,8 @@ initialization =
...
@@ -71,6 +71,8 @@ initialization =
parser.add_argument('ipv6')
parser.add_argument('ipv6')
parser.add_argument('server_port', type=int)
parser.add_argument('server_port', type=int)
parser.add_argument('computer_id')
parser.add_argument('computer_id')
parser.add_argument('--sr')
parser.add_argument('--srtype')
forwarded_arguments = parser.add_argument_group('forwarded')
forwarded_arguments = parser.add_argument_group('forwarded')
forwarded_arguments.add_argument('master_url')
forwarded_arguments.add_argument('master_url')
forwarded_arguments.add_argument('computer')
forwarded_arguments.add_argument('computer')
...
@@ -119,6 +121,11 @@ initialization =
...
@@ -119,6 +121,11 @@ initialization =
except slapos.slap.standalone.SlapOSNodeCommandError as e:
except slapos.slap.standalone.SlapOSNodeCommandError as e:
print("Error instanciating: {}".format(e))
print("Error instanciating: {}".format(e))
if args.sr:
print("Supplying and Requesting Embedded Software {}".format(args.sr))
standalone.supply(args.sr)
standalone.request(args.sr, "Embedded Instance", args.srtype or None)
quit_requested = []
quit_requested = []
def signal_handler(signum, frame):
def signal_handler(signum, frame):
print("Signal {signum} received".format(signum=signum))
print("Signal {signum} received".format(signum=signum))
...
...
software/theia/test/test.py
View file @
c61e5df3
...
@@ -38,6 +38,7 @@ from six.moves.urllib.parse import urlparse, urljoin
...
@@ -38,6 +38,7 @@ from six.moves.urllib.parse import urlparse, urljoin
import
pexpect
import
pexpect
import
psutil
import
psutil
import
requests
import
requests
import
sqlite3
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
from
slapos.grid.svcbackend
import
getSupervisorRPC
from
slapos.grid.svcbackend
import
getSupervisorRPC
...
@@ -184,3 +185,59 @@ class TestTheiaEmbeddedSlapOSShutdown(SlapOSInstanceTestCase):
...
@@ -184,3 +185,59 @@ class TestTheiaEmbeddedSlapOSShutdown(SlapOSInstanceTestCase):
# the supervisor controlling instances is also stopped
# the supervisor controlling instances is also stopped
self
.
assertFalse
(
embedded_slapos_process
.
is_running
())
self
.
assertFalse
(
embedded_slapos_process
.
is_running
())
class
SQLiteDB
(
object
):
def
__init__
(
self
,
sqlitedb_file
):
self
.
sqlitedb_file
=
sqlitedb_file
def
select
(
self
,
fields
,
table
,
where
=
{}):
connection
=
sqlite3
.
connect
(
self
.
sqlitedb_file
)
def
dict_factory
(
cursor
,
row
):
d
=
{}
for
idx
,
col
in
enumerate
(
cursor
.
description
):
d
[
col
[
0
]]
=
row
[
idx
]
return
d
connection
.
row_factory
=
dict_factory
cursor
=
connection
.
cursor
()
condition
=
" AND "
.
join
(
"%s='%s'"
%
(
k
,
v
)
for
k
,
v
in
where
.
items
())
cursor
.
execute
(
"SELECT %s FROM %s%s"
%
(
", "
.
join
(
fields
),
table
,
" WHERE %s"
%
condition
if
where
else
""
,
)
)
return
cursor
.
fetchall
()
class
TestTheiaWithSR
(
SlapOSInstanceTestCase
):
__partition_reference__
=
'T'
# for sockets in included slapos
srurl
=
'bogus/software.cfg'
srtype
=
'bogus'
@
classmethod
def
getInstanceParameterDict
(
cls
):
return
{
'embedded-sr'
:
cls
.
srurl
,
'embedded-sr-type'
:
cls
.
srtype
,
}
def
test
(
self
):
db
=
SQLiteDB
(
os
.
path
.
join
(
self
.
computer_partition_root_path
,
'srv'
,
'runner'
,
'var'
,
'proxy.db'
))
supplied
=
db
.
select
(
fields
=
[
"*"
],
table
=
"software14"
,
where
=
{
'url'
:
self
.
srurl
}
)
self
.
assertEqual
(
len
(
supplied
),
1
)
requested
=
db
.
select
(
fields
=
[
"*"
],
table
=
"partition14"
,
where
=
{
'software_release'
:
self
.
srurl
,
'software_type'
:
self
.
srtype
}
)
self
.
assertEqual
(
len
(
requested
),
1
)
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