On 29 June 2017 at 09:52, Li, Yifan2 <yifan2.li@intel.com> wrote:
Hello LAVA experts,
 
I am currently working with LAVA and was asked to find is there a way to get data from device dictionary inside a running job. Details like below:
I have a device name demo-01, and its device-dictionary have one line like “{% set my_property = ’my_prop’ %}”. Then I have a job running on demo-01 device, and I would like to use string ‘my_prop’ to passed into a script during running. Is it possible to get device-dictionary data directly from job definition(Job Submitter webpage) or test definition(yaml file)? If yes, how could I do this? If not, is there any good way you would like to share to solve this problem?

No, device configuration should generally not be available inside the test shell, it is admin-specific and a lot of the commands can often be inaccessible to the test shell or use scripts which only exist on the worker or be blocked by network configuration etc. There is no guarantee that a test shell running on a device will be able to contact the master, so direct retrieval is unlikely to work (plus you'd need a parser at the other end).

What is the property you are trying to set and retrieve and why? What does the test shell do with the value?

The test job submission itself support parameters and these are passed into the test shell. The most common example of that is the hacking session:
https://validation.linaro.org/static/docs/v2/hacking-session.html#hacking-session

We do have support for exporting some values into the test shell overlay - lava-target-mac is one (we need some documentation of that but it has a fairly limited use case, so it's been largely internal until now).

https://git.linaro.org/lava/lava-server.git/tree/lava_scheduler_app/tests/device-types/base.jinja2#n153
https://git.linaro.org/lava/lava-server.git/tree/lava_scheduler_app/tests/device-types/juno-uboot.jinja2#n34
https://git.linaro.org/lava/lava-lab.git/tree/playground.validation.linaro.org/lava/pipeline/devices/pg-juno-01.jinja2#n6
https://git.linaro.org/lava/lava-dispatcher.git/tree/lava_dispatcher/pipeline/lava_test_shell/lava-target-ip
https://git.linaro.org/lava/lava-dispatcher.git/tree/lava_dispatcher/pipeline/lava_test_shell/lava-target-mac


--