Add nbroles_to_grains script + add note

Script allows for testing and pipeline minions to work without access to
the roles API. Additionally added a note about this in prepare_minion.py.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2023-01-21 18:38:41 +01:00
parent 8c72e7c63a
commit 97db5ef6db
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57
2 changed files with 5 additions and 0 deletions

4
bin/nbroles_to_grains.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
# This rewrites top-files to fetch roles from grains instead of our custom roles API. Useful for testing outside of the LibertaCasa infrastructure, but not recommended for production.
sed -i "s/salt\['nbroles.get'\](id)/grains\['roles'\]/" */top.sls

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python3
# Prepares a minion for local testing of Salt code in this repository. Requires roles to be written as grains, as development and pipeline containers generally do not have access to our roles API. Consider nbroles_to_grains.sh first if this is the case.
import roles
import os