revert startup scripts to use key for object name
This commit is contained in:
parent
71d8ac10ac
commit
a1e0c52825
|
@ -1,9 +1,9 @@
|
|||
# - name: applications
|
||||
# applications:
|
||||
# users:
|
||||
# - technical_user
|
||||
# - name: readers
|
||||
# readers:
|
||||
# users:
|
||||
# - reader
|
||||
# - name: writers
|
||||
# writers:
|
||||
# users:
|
||||
# - writer
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# - username: technical_user
|
||||
# technical_user:
|
||||
# api_token: 0123456789technicaluser789abcdef01234567 # must be looooong!
|
||||
# - username: reader
|
||||
# reader:
|
||||
# password: reader
|
||||
# - username: writer
|
||||
# writer:
|
||||
# password: writer
|
||||
# - username: jdoe
|
||||
# jdoe:
|
||||
# first_name: John
|
||||
# last_name: Doe
|
||||
# api_token: 0123456789jdoe789abcdef01234567jdoe
|
||||
|
|
|
@ -7,15 +7,13 @@ groups = load_yaml("/opt/netbox/initializers/groups.yml")
|
|||
if groups is None:
|
||||
sys.exit()
|
||||
|
||||
for params in groups:
|
||||
groupname = params["name"]
|
||||
|
||||
for groupname, group_details in groups.items():
|
||||
group, created = AdminGroup.objects.get_or_create(name=groupname)
|
||||
|
||||
if created:
|
||||
print("👥 Created group", groupname)
|
||||
|
||||
for username in params.get("users", []):
|
||||
for username in group_details.get("users", []):
|
||||
user = AdminUser.objects.get(username=username)
|
||||
|
||||
if user:
|
||||
|
|
Loading…
Reference in New Issue