W dniu 31.07.2012 22:53, Andy Doan pisze:
I'm not really finding good sources for help with defining json schema
rules, so I thought I'd ask here.
I'd like to update our current boot-linaro-image action in the
lava-dispatcher to take a new optional parameter called "boot_options", eg:
{
"command": "boot_linaro_image",
"parameters": {
"options": [ "coretile.cache_state_modelled=1" ]
}
}
I tried to do this by updating parameters_schema in boot_control.py with:
+_boot_schema = {
+ 'type': 'object',
+ 'properties': {
+ 'options': {'type': 'array', 'items': {'type': 'string'},
+ 'optional': True},
+ },
+ 'additionalProperties': False,
+ }
However, now "parameters" is always required which we would be horrible
for backward compatibility. Anybody know how I should go about this?
You'd have to use defaults, having a default section for the entire
'parameters' part. Schema can define parameters but without
json-document you're not likely to use them automatically.
I would recommend patching the dispatcher code to make 'parameters'
default to empty dict if missing. Then the would work as you wish.
1) Patch generic dispatcher to assume parameters defaults to {} (if needed)
2) Add the schema for 'options' (almost as above but the schema above
does not match the example)
It should just work.
PS: You may want to look at how I solved this in lava-core with
ObjectWithConfiguration and json-document
Thanks
ZK
--
Zygmunt Krynicki
Linaro Validation Team
s/Validation/Android/
_______________________________________________
linaro-validation mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/linaro-validation