72 lines
2.8 KiB
Python
72 lines
2.8 KiB
Python
|
from risotto.controller import Controller
|
||
|
from risotto.register import register
|
||
|
|
||
|
class Risotto(Controller):
|
||
|
@register('v1.servermodel.list', None)
|
||
|
async def servermodel_list(self, sourceid):
|
||
|
return [{'servermodelid': 1,
|
||
|
'servermodelname': 'name1',
|
||
|
'subreleasename': 'name1',
|
||
|
'sourceid': 1,
|
||
|
'servermodeldescription': 'description1'},
|
||
|
{'servermodelid': 2,
|
||
|
'servermodelname': 'name2',
|
||
|
'subreleasename': 'name2',
|
||
|
'sourceid': 2,
|
||
|
'servermodeldescription': 'description2',
|
||
|
'servermodelparentsid': [1]}]
|
||
|
|
||
|
@register('v1.servermodel.describe', None)
|
||
|
async def servermodel_describe(self, inheritance, creolefuncs, servermodelid, schema, conffiles, resolvdepends, probes):
|
||
|
schema = """<?xml version='1.0' encoding='UTF-8'?>
|
||
|
<creole>
|
||
|
<family name="containers">
|
||
|
<family name="container0" doc="test">
|
||
|
<family doc="files" name="files">
|
||
|
<family doc="file0" name="file0">
|
||
|
<variable doc="" multi="False" name="mkdir" type="boolean">
|
||
|
<value>False</value>
|
||
|
</variable>
|
||
|
<variable doc="" multi="False" name="name" type="string">
|
||
|
<value>/etc/mailname</value>
|
||
|
</variable>
|
||
|
<variable doc="" multi="False" name="rm" type="boolean">
|
||
|
<value>False</value>
|
||
|
</variable>
|
||
|
<variable doc="" multi="False" name="source" type="string">
|
||
|
<value>mailname</value>
|
||
|
</variable>
|
||
|
<variable doc="" multi="False" name="activate" type="boolean">
|
||
|
<value>True</value>
|
||
|
</variable>
|
||
|
</family>
|
||
|
</family>
|
||
|
<property>basic</property>
|
||
|
</family>
|
||
|
</family>
|
||
|
<family doc="" name="creole">
|
||
|
<family doc="general" name="general">
|
||
|
<property>normal</property>
|
||
|
<variable doc="No change" multi="False" name="mode_conteneur_actif" type="choice">
|
||
|
<choice type="string">oui</choice>
|
||
|
<choice type="string">non</choice>
|
||
|
<property>mandatory</property>
|
||
|
<property>normal</property>
|
||
|
<value type="string">non</value>
|
||
|
</variable>
|
||
|
<leader doc="master" name="master">
|
||
|
<property>normal</property>
|
||
|
<variable doc="master" multi="True" name="master" type="string"/>
|
||
|
<variable doc="slave1" multi="True" name="slave1" type="string">
|
||
|
<property>normal</property>
|
||
|
</variable>
|
||
|
<variable doc="slave2" multi="True" name="slave2" type="string">
|
||
|
<property>normal</property>
|
||
|
</variable>
|
||
|
</leader>
|
||
|
</family>
|
||
|
<separators/>
|
||
|
</family>
|
||
|
</creole>"""
|
||
|
return {'servermodelid': 1, 'servermodelname': 'name', 'servermodeldescription': 'description', 'subreleasename': 'name', 'sourceid': 1, 'schema': schema, 'creolefuncs': ''}
|