Hello everyone,
is there a way of setting tags for existing devices via the command line? The "lava-server manage devices update" command does not have a "--tags" parameter, as the "lava-server manage devices add" has.
Tags can currently only be set for devices when the device is added. When the update command was created, manipulating tags was out of scope. If you fancy working on that support, that would be handy.
For everyone interested in this feature: I have found a much more flexible solution using the "lava-server manage shell" command. This provides a Python shell offering all possible modifications using the LAVA Python API.
Minimal example:
from lava_scheduler_app.models import Device, Tag
device = Device.objects.get(hostname="mydevice") tag = Tag.objects.get_or_create(name="mytag")[0] device.tags.add(tag)
Tags can be removed similarly, using "device.tags.remove(tag)".
Python script files can be passed to the lava-server command using standard Linux redirection:
lava-server manage shell < myscript.py
I did not find this anywhere in the LAVA docs. Is there a reason for that? I am using this Python API now with Ansible for LAVA device creation as well as for users, groups, permissions and authentication tokens. Works reliably.
Mit freundlichen Grüßen / Best regards Tim Jaacks DEVELOPMENT ENGINEER Garz & Fricke GmbH Tempowerkring 2 21079 Hamburg Direct: +49 40 791 899 - 55 Fax: +49 40 791899 - 39 tim.jaacks@garz-fricke.com www.garz-fricke.com SOLUTIONS THAT COMPLETE!
Sitz der Gesellschaft: D-21079 Hamburg Registergericht: Amtsgericht Hamburg, HRB 60514 Geschäftsführer: Matthias Fricke, Manfred Garz