Skip to content

Commit

Permalink
Merge pull request #74 from aldbr/main_FIX_init-cs
Browse files Browse the repository at this point in the history
fix: init-cs
  • Loading branch information
chrisburr authored Nov 28, 2023
2 parents 0b575d3 + 206bf2e commit c26d757
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
21 changes: 9 additions & 12 deletions demo/values.tpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@ developer:
nodeModuleToInstall: {{ node_module_to_mount }}

init-cs:
defaultVOs:
VOs:
- name: diracAdmin
idp_url: http://{{ hostname }}:32002
idp_client_id: d396912e-2f04-439b-8ae7-d8c585a34790
defaultGroups:
- vo: diracAdmin
name: admin
defaultUsers:
- vo: diracAdmin
userGroup: admin
sub: EgVsb2NhbA
preferredUsername: admin
# TODO: Integrate with dex
IdP:
idp_url: http://{{ hostname }}:32002
idp_client_id: d396912e-2f04-439b-8ae7-d8c585a34790
defaultGroup: admin
Users:
- sub: EgVsb2NhbA
preferredUsername: admin
# TODO: Integrate with dex

diracx:
hostname: {{ hostname }}
Expand Down
29 changes: 19 additions & 10 deletions diracx/templates/init-cs/_init-cs.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,32 @@ fi

dirac internal generate-cs /cs_store/initialRepo

{{- range $vo := index .Values "init-cs" "defaultVOs" }}
{{- range $vo := index .Values "init-cs" "VOs" }}
dirac internal add-vo /cs_store/initialRepo \
--vo={{ $vo.name | quote }} \
--idp-url={{ $vo.idp_url | quote }} \
--idp-client-id={{ $vo.idp_client_id | quote }}
--idp-url={{ $vo.IdP.idp_url | quote }} \
--idp-client-id={{ $vo.IdP.idp_client_id | quote }} \
{{- with $vo.defaultGroup }}
--default-group={{ . | quote }}
{{- end }}

{{- range $group := index .Values "init-cs" "defaultGroups" }}
{{- with $vo.Groups }}
{{- range $group := $vo.Groups }}
dirac internal add-group /cs_store/initialRepo \
--vo={{ $group.vo | quote }} \
--group={{ $group.name | quote }}
--vo={{ $vo.name | quote }} \
--group={{ $group.name | quote }} \
{{- end }}
{{- end }}

{{- range $user := index .Values "init-cs" "defaultUsers" }}
{{- with $vo.Users }}
{{- range $user := $vo.Users }}
dirac internal add-user /cs_store/initialRepo \
--vo={{ $user.vo | quote }} \
--user-group={{ $user.userGroup | quote }} \
--vo={{ $vo.name | quote }} \
--sub={{ $user.sub | quote }} \
--preferred-username={{ $user.preferredUsername | quote }}
--preferred-username={{ $user.preferredUsername | quote }} \
{{- range $usergroup := $user.groups }}
--groups={{ $usergroup | quote }} \
{{- end }}
{{- end }}
{{- end }}
{{- end }}

0 comments on commit c26d757

Please sign in to comment.