server name is a domain name

This commit is contained in:
Emmanuel Garette 2020-02-26 08:29:25 +01:00
parent 9d79eef47f
commit 5ac9ec72f8
3 changed files with 20 additions and 8 deletions

View File

@ -59,7 +59,7 @@ drop table value; drop table property; drop table permissive; drop table informa
# Heritage
## ACA
./script/cucchiaiata servermodel.create -n aca -d Aca -p eolebase -s eole -r last
./script/cucchiaiata servermodel.create -n aca -d Aca -p base -s eole -r last
./script/cucchiaiata session.servermodel.start -s aca
S=xxxxxxxxxxxxxxxxxxxxxx
### verif
@ -100,7 +100,7 @@ S=xxxxxxxxxxxxxxxxxxxxxx
XXXXX
# Create a server
./script/cucchiaiata server.create -s test -d description -m unbound_etab1 -r last
./script/cucchiaiata server.create -s test.cadoles.com -d description -m unbound_etab1 -r last
./script/cucchiaiata session.server.start -s test
S=xxxxxxxxxxxxxxxxxxxxxx
@ -114,4 +114,3 @@ S=xxxxxxxxxxxxxxxxxxxxxx
# OpenSSH
./script/cucchiaiata applicationservice.dependency.add -n local_aca -a openssh -s eole -r last

View File

@ -6,6 +6,7 @@ from traceback import print_exc
from typing import Dict, List
from tiramisu import Storage, MixConfig
from tiramisu.error import PropertiesOptionError
from rougail import load as rougail_load
from rougail.config import dtdfilename
@ -230,21 +231,30 @@ class Risotto(Controller):
'server_to_deploy': await self.build_config(f'std_{server_id}',
server_id,
server_name,
mixconfig),
mixconfig,
std=True),
'funcs_file': self.get_funcs_filename(server_servermodel_id)}
async def build_config(self,
session_id: str,
server_id: int,
server_name: str,
mixconfig: MixConfig) -> None:
mixconfig: MixConfig,
std: bool=False) -> None:
""" build server's config
"""
config = await mixconfig.config.new(session_id,
storage=self.save_storage)
await config.information.set('server_id', server_id)
await config.information.set('server_name', server_name)
option_value = config.option('creole.interface_0.domain_name_eth0').value
if std:
try:
await option_value.get()
except PropertiesOptionError:
await config.owner.set(server_name)
await config.property.read_write()
await config.option('creole.interface_0.domain_name_eth0').value.set(server_name)
await config.property.read_only()
return config
@ -307,6 +317,7 @@ class Risotto(Controller):
mixconfig = self.servermodel.pop(servermodel_id)
children = []
for child in await mixconfig.config.list():
if not (await child.session.id()).startswith('std_'):
children.append(child)
await mixconfig.config.pop(await child.session.id())
for parent in await mixconfig.config.parents():

View File

@ -1,4 +1,5 @@
from typing import Dict
from tiramisu import DomainnameOption
from ...controller import Controller
from ...register import register
@ -29,6 +30,7 @@ class Risotto(Controller):
server_description: str,
servermodel_name: str,
release_distribution: str) -> Dict:
DomainnameOption('server_name', _('Server name'), server_name)
servermodel = await self.call('v1.servermodel.describe',
risotto_context,
servermodel_name=servermodel_name,