2021-02-08 04:59:33 -06:00
|
|
|
import sys
|
2020-12-29 18:36:58 -06:00
|
|
|
from secrets.models import SecretRole
|
2021-02-08 04:59:33 -06:00
|
|
|
|
2020-12-29 18:36:58 -06:00
|
|
|
from startup_script_utils import load_yaml
|
|
|
|
|
2021-02-08 04:59:33 -06:00
|
|
|
secret_roles = load_yaml("/opt/netbox/initializers/secret_roles.yml")
|
2020-12-29 18:36:58 -06:00
|
|
|
|
|
|
|
if secret_roles is None:
|
2021-02-08 04:59:33 -06:00
|
|
|
sys.exit()
|
2020-12-29 18:36:58 -06:00
|
|
|
|
|
|
|
for params in secret_roles:
|
2021-02-08 04:59:33 -06:00
|
|
|
secret_role, created = SecretRole.objects.get_or_create(**params)
|
2020-12-29 18:36:58 -06:00
|
|
|
|
2021-02-08 04:59:33 -06:00
|
|
|
if created:
|
|
|
|
print("🔑 Created Secret Role", secret_role.name)
|