On 07/17/2014 12:10 AM, Sheldon wrote:
On 07/17/2014 08:44 AM, Aline Manera wrote:
>
> On 07/15/2014 12:45 PM, shaohef(a)linux.vnet.ibm.com wrote:
>> From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
>>
>> we set ticket as sub-resource of vm resource.
>>
>> Signed-off-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
>> ---
>> src/kimchi/API.json | 14 ++++++++++++++
>> src/kimchi/control/vms.py | 13 +++++++++++++
>> 2 files changed, 27 insertions(+)
>>
>> diff --git a/src/kimchi/API.json b/src/kimchi/API.json
>> index 3616509..f5087e7 100644
>> --- a/src/kimchi/API.json
>> +++ b/src/kimchi/API.json
>> @@ -328,6 +328,20 @@
>> }
>> }
>> },
>> + "vmticket_update": {
>> + "type": "object",
>> + "properties": {
>> + "passwd": {
>> + "description": "the password of ticket.",
>> + "minLength": 1,
>> + "type": "string"
>
> You need to set the "error" string for invalid inputs
during your vocation, we have discuss this problem:
here is the log of our discussion.
http://lists.ovirt.org/pipermail/kimchi-devel/2014-May/005306.html
and it is improved for this "error" string
http://lists.ovirt.org/pipermail/kimchi-devel/2014-May/005377.html
we think for some schema item, we do not need "error". we let kimchi
catch this error, and generates an common exception string.
The generated exception string can not be translated by kimchi, it
just depends on
jsonschema to translate it.
Because of the exception error can not be translated by Kimchi, we have
the "error" parameter
With the error parameter the whole message is translated
>
>> + },
>> + "expire": {
>> + "description": "lifetime of a ticket.",
>> + "type": "number"
>
> Same for expire
>
>> + }
>> + }
>> + },
>> "templates_create": {
>> "type": "object",
>> "error": "KCHTMPL0016E",
>> diff --git a/src/kimchi/control/vms.py b/src/kimchi/control/vms.py
>> index 508f478..acc4a1f 100644
>> --- a/src/kimchi/control/vms.py
>> +++ b/src/kimchi/control/vms.py
>> @@ -34,6 +34,7 @@ def __init__(self, model, ident):
>> super(VM, self).__init__(model, ident)
>> self.update_params = ["name", "users", "groups",
"cpus", "memory"]
>> self.screenshot = VMScreenShot(model, ident)
>> + self.ticket = VMTicket(model, ident)
>> self.uri_fmt = '/vms/%s'
>> for ident, node in sub_nodes.items():
>> setattr(self, ident, node(model, self.ident))
>> @@ -55,3 +56,15 @@ def __init__(self, model, ident):
>> def get(self):
>> self.lookup()
>> raise internal_redirect(self.info)
>> +
>> +
>> +class VMTicket(Resource):
>> + def __init__(self, model, ident):
>> + super(VMTicket, self).__init__(model, ident)
>> + self.update_params = ["passwd", "expire"]
>> + self.uri_fmt = '/vms/%s/ticket'
>> + self.reset = self.generate_action_handler('reset')
>> +
>> + @property
>> + def data(self):
>> + return self.info
>
>
>