Commit f8243cc1 authored by Matthieu Lamalle's avatar Matthieu Lamalle
Browse files

Migration to Gitlab

parent cf261202
......@@ -73,6 +73,18 @@ class ServerRunner(ZephirCommonController):
return b'{}'
@register_wamp('v1.server.config.get', notification_uri=None, database=True)
async def get_config(self, cursor, serverid):
return {'configuration': serverid}
@register_http('v1.server.config.get', param='configuration', database=True)
async def get_config_file(self, cursor, secret):
values = self.server.fetch_configuration(cursor, secret)
if values:
return json.dumps(values).encode()
return b'{}'
@register_wamp('v1.server.create', notification_uri='v1.server.created', database=True)
async def create_server(self, cursor, servername, serverdescription, servermodelid, serverpassphrase):
......@@ -41,3 +41,5 @@ class ServerErrorUnknownServerId(ServerError):
class ServerErrorUnknownServerModelId(ServerError):
"""Unknown servermodel ID
......@@ -26,7 +26,6 @@ FETCH_SERVER_AUTOMATION = '''
WHERE serverid = %s
Creates a server based on its name and servermodel
import json
from zephir.config import ServiceConfig
from server.server import Server
from zephir.database import connect
......@@ -61,3 +63,14 @@ def test_get_automation_command():
rserver = server.create_server(cursor, "my_beautiful_server", "server's description", servermodelid)
server.register_server_for_automation(cursor, rserver['serverid'], "salt")
assert server.get_automation_command(cursor, rserver['serverid']) == ("salt", "")
def test_get_config():
global server, cursor, servermodelid
rserver = server.create_server(cursor, "my_beautiful_server", "server's description", servermodelid)
result = None
assert server.fetch_configuration(cursor, rserver['serverid']) == result
configuration = '{"creole.general.numero_etab": "000007", \
"creole.interface_0.adresse_ip_eth0": "", \
"creole.interface_0.interface_gw": "ens4"}'
server.update_configuration(cursor, rserver['serverid'], configuration)
assert server.fetch_configuration(cursor, rserver['serverid']) == json.loads(configuration)
Supports Markdown
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