Commit 1b4653ad authored by Xavier Thompson's avatar Xavier Thompson

software/jupyter: Unserialize connection parameters

parent 1fcf1800
...@@ -19,7 +19,7 @@ md5sum = de37ec3d4adb0be4c67bcc7397f27c91 ...@@ -19,7 +19,7 @@ md5sum = de37ec3d4adb0be4c67bcc7397f27c91
[instance-jupyter] [instance-jupyter]
filename = instance-jupyter.cfg.in filename = instance-jupyter.cfg.in
md5sum = 38bbb350a07ad2bb9f01b46122231708 md5sum = cbc90e517ae3680ab8bef04c6f503af5
[jupyter-notebook-config] [jupyter-notebook-config]
filename = jupyter_notebook_config.py.jinja filename = jupyter_notebook_config.py.jinja
......
...@@ -175,7 +175,7 @@ instance-configuration = ...@@ -175,7 +175,7 @@ instance-configuration =
raw jupyter-password ${jupyter-password:passwd} raw jupyter-password ${jupyter-password:passwd}
[publish-connection-parameter] [publish-connection-parameter]
recipe = slapos.cookbook:publish.serialised recipe = slapos.cookbook:publish
jupyter-classic-url = ${request-slave-frontend:connection-secure_access}/tree jupyter-classic-url = ${request-slave-frontend:connection-secure_access}/tree
url = ${:jupyter-classic-url} url = ${:jupyter-classic-url}
jupyterlab-url = ${request-slave-frontend:connection-secure_access}/lab jupyterlab-url = ${request-slave-frontend:connection-secure_access}/lab
......
...@@ -43,12 +43,7 @@ setUpModule, InstanceTestCase = makeModuleSetUpAndTestCaseClass( ...@@ -43,12 +43,7 @@ setUpModule, InstanceTestCase = makeModuleSetUpAndTestCaseClass(
class TestJupyter(InstanceTestCase): class TestJupyter(InstanceTestCase):
def test(self): def test(self):
parameter_dict = self.computer_partition.getConnectionParameterDict() connection_dict = self.computer_partition.getConnectionParameterDict()
self.assertTrue('_' in parameter_dict)
try:
connection_dict = json.loads(parameter_dict['_'])
except Exception as e:
self.fail("Can't parse json in %s, error %s" % (parameter_dict['_'], e))
self.assertTrue('password' in connection_dict) self.assertTrue('password' in connection_dict)
password = connection_dict['password'] password = connection_dict['password']
...@@ -92,15 +87,11 @@ class TestJupyterAdditional(InstanceTestCase): ...@@ -92,15 +87,11 @@ class TestJupyterAdditional(InstanceTestCase):
@classmethod @classmethod
def getInstanceParameterDict(cls): def getInstanceParameterDict(cls):
return { return {
'frontend-additional-instance-guid': 'SOMETHING' } 'frontend-additional-instance-guid': 'SOMETHING'
}
def test(self): def test(self):
parameter_dict = self.computer_partition.getConnectionParameterDict() connection_dict = self.computer_partition.getConnectionParameterDict()
self.assertTrue('_' in parameter_dict)
try:
connection_dict = json.loads(parameter_dict['_'])
except Exception as e:
self.fail("Can't parse json in %s, error %s" % (parameter_dict['_'], e))
result = requests.get( result = requests.get(
connection_dict['url'], verify=False, allow_redirects=False) connection_dict['url'], verify=False, allow_redirects=False)
...@@ -151,12 +142,7 @@ class TestJupyterAdditional(InstanceTestCase): ...@@ -151,12 +142,7 @@ class TestJupyterAdditional(InstanceTestCase):
class TestJupyterPassword(InstanceTestCase): class TestJupyterPassword(InstanceTestCase):
def test(self): def test(self):
parameter_dict = self.computer_partition.getConnectionParameterDict() connection_dict = self.computer_partition.getConnectionParameterDict()
self.assertTrue('_' in parameter_dict)
try:
connection_dict = json.loads(parameter_dict['_'])
except Exception as e:
self.fail("Can't parse json in %s, error %s" % (parameter_dict['_'], e))
url = connection_dict['url'] url = connection_dict['url']
with requests.Session() as s: with requests.Session() as s:
......
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