Commit 0ebe5ebb authored by Xavier Thompson's avatar Xavier Thompson Committed by Thomas Gambier

software/theia: Use slap-connection shared-parts

This will let a non-shared Theia (for example coming from shacache
binary) to be able to use the shared parts of a machine.

See merge request !1409
parent cad76981
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
[instance-theia] [instance-theia]
_update_hash_filename_ = instance-theia.cfg.jinja.in _update_hash_filename_ = instance-theia.cfg.jinja.in
md5sum = b406265f591f54a0d5a6aa3ff8522764 md5sum = c484bba770c6404ba0a5b2a958b07a68
[instance] [instance]
_update_hash_filename_ = instance.cfg.in _update_hash_filename_ = instance.cfg.in
md5sum = f322033a7670b9be29b1bf1bf9024b87 md5sum = 9658a11340c018de816d0de40683706a
[instance-import] [instance-import]
_update_hash_filename_ = instance-import.cfg.jinja.in _update_hash_filename_ = instance-import.cfg.jinja.in
......
...@@ -593,7 +593,11 @@ output = $${directory:bin}/$${:_buildout_section_name_} ...@@ -593,7 +593,11 @@ output = $${directory:bin}/$${:_buildout_section_name_}
embedded-request-exitcode-file = $${directory:statefiles}/embedded-request.exitcode embedded-request-exitcode-file = $${directory:statefiles}/embedded-request.exitcode
standalone-ran-before-flag = $${directory:statefiles}/standalone-ran-before.flag standalone-ran-before-flag = $${directory:statefiles}/standalone-ran-before.flag
shared-part-list = shared-part-list =
{%- if 'shared-part-list' in slap_connection %}
{{ slap_connection['shared-part-list'] | indent(2) }}
{%- else %}
{{ """${buildout:shared-part-list}""" | indent(2) }} {{ """${buildout:shared-part-list}""" | indent(2) }}
{%- endif %}
context = context =
raw python_for_standalone ${python-for-standalone:executable} raw python_for_standalone ${python-for-standalone:executable}
raw request_script_path $${directory:project}/request-embedded-instance.sh raw request_script_path $${directory:project}/request-embedded-instance.sh
......
...@@ -33,6 +33,7 @@ url = ${instance-theia:output} ...@@ -33,6 +33,7 @@ url = ${instance-theia:output}
output = $${buildout:directory}/instance-theia.cfg output = $${buildout:directory}/instance-theia.cfg
extensions = jinja2.ext.do extensions = jinja2.ext.do
context = context =
section slap_connection slap-connection
jsonkey default_parameter_dict :default-parameters jsonkey default_parameter_dict :default-parameters
key parameter_dict slap-configuration:configuration key parameter_dict slap-configuration:configuration
key root_title slap-configuration:root-instance-title key root_title slap-configuration:root-instance-title
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
############################################################################## ##############################################################################
from __future__ import unicode_literals from __future__ import unicode_literals
import configparser
import json import json
import logging import logging
import os import os
...@@ -45,6 +46,7 @@ from six.moves.urllib.parse import urlparse, urljoin ...@@ -45,6 +46,7 @@ from six.moves.urllib.parse import urlparse, urljoin
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass, SlapOSNodeCommandError from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass, SlapOSNodeCommandError
from slapos.grid.svcbackend import getSupervisorRPC, _getSupervisordSocketPath from slapos.grid.svcbackend import getSupervisorRPC, _getSupervisordSocketPath
from slapos.proxy.db_version import DB_VERSION from slapos.proxy.db_version import DB_VERSION
from slapos.slap.standalone import SlapOSConfigWriter
theia_software_release_url = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'software.cfg')) theia_software_release_url = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'software.cfg'))
...@@ -510,6 +512,32 @@ class TestTheiaEnv(TheiaTestCase): ...@@ -510,6 +512,32 @@ class TestTheiaEnv(TheiaTestCase):
self.assertEqual(theia_shell_env['HOME'], supervisord_env['HOME']) self.assertEqual(theia_shell_env['HOME'], supervisord_env['HOME'])
class TestTheiaSharedPath(TheiaTestCase):
bogus_path = 'bogus'
@classmethod
def setUpClass(cls):
super(TestTheiaSharedPath, cls).setUpClass()
# Change shared part list to include bogus paths
cls.slap._shared_part_list.append(cls.bogus_path)
SlapOSConfigWriter(cls.slap).writeConfig(cls.slap._slapos_config)
# Re-instanciate
cls.slap._force_slapos_node_instance_all = True
try:
cls.waitForInstance()
finally:
cls.slap._force_slapos_node_instance_all = False
def test(self):
theia_cfg_path = self.getPath('srv', 'runner', 'etc', 'slapos.cfg')
cfg = configparser.ConfigParser()
cfg.read(theia_cfg_path)
self.assertTrue(cfg.has_option('slapos', 'shared_part_list'))
shared_parts_string = cfg.get('slapos', 'shared_part_list')
shared_parts_list = [s.strip() for s in shared_parts_string.splitlines()]
self.assertIn(self.bogus_path, shared_parts_list)
class ResilientTheiaMixin(object): class ResilientTheiaMixin(object):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment