New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Structuring multiple boards in environment config #1194
Comments
I'd suggest using templating in this case, see labgrid's environment configuration docs: targets:
main:
resources:
RemotePlace:
name: !template $LG_PLACE
drivers:
- ModbusCoilDriver: {}
- ModbusCoilDriver:
name: power
bindings:
coil: power
- DigitalOutputPowerDriver:
bindings:
output: power
- SerialDriver: {}
- UBootDriver:
autoboot: Type password
interrupt: e
prompt: '=> '
bootstring: Starting kernel ...
boot_commands:
usb: run usbbootcmd
- ShellDriver:
prompt: 'user@localhost:~# '
login_prompt: '[^ ]+ login: '
username: user
password: password
- SSHDriver: {}
- UBootStrategy: {}
bbb:
resources:
RemotePlace:
name: !template "$LG_PLACE-bbb"
drivers:
- ModbusCoilDriver: {}
- DigitalOutputPowerDriver: {}
- SSHDriver: {} Then select a board via.. $ export LG_PLACE=board1 |
I like the template based on the place. It works well for my boards even when using tokens. But I can not access the -bbb places. I think it's because when I acquire board1-bbb, then it's considered as a board. Here is the error:
|
If you want to interact with "board1" and $ export LG_ENV=~/board-template.yaml
$ export LG_PLACE=board-1
$ labgrid-client lock
acquired place board1
$ labgrid-client ssh true
Selected role main from configuration file And with "board1-bbb" and $ labgrid-client -p board1-bbb lock
acquired place board1-bbb
$ labgrid-client -p board1-bbb ssh true
Selected role main from configuration file |
Right this works when setting
|
I was wrong, it doesn't work for tokens. But with the following patch, it does (I will work on it and submit a PR):
With this I can successfully use the following environment file:
|
With #1208, what's left in this issue that's not solved then? |
This syntax is not supported by #1208: But it can be tricky (do we allow "prefix-$LG_PLACE-suffix"?) and I am happy with using yaml syntax to repeat the boardX-bbb configuration has it should not need to be changed. |
I see. How exactly would "using yaml syntax to repeat the boardX-bbb configuration" look like? |
I use this for the bbb:
and so on |
Ah nice, I was not aware that this works already. If I remember correctly, yaml merge ( |
I am setting up a lab with 8 different hardware that are similar from a LabGrid point-of-view. Beside these 8 boards, I have 8 helper hardware (1 for each board) that are exactly the same (BeagleBone Black).
My goal is to provide an environment file to my colleagues so they are able to work on any board.
The environment file looks like this:
I can reduce the repetition using yaml syntax
One way that seems more intuitive and reduce repetition is for
RemotePlace
to support a list:Another way is for the environment configuration file to use Jinja2 as a preprocessor, like the exporter configuration file:
I like the 'RemotePlace list' better because it emphasis the role and make it easy to assign boards to another role, should this be needed in the future.
What do you think about this?
How does you environment file look like and how do you maintain/share it?
The text was updated successfully, but these errors were encountered: