Skip to content

Commit fe38886

Browse files
author
Georg Martin Weber
committed
common extraVolumes support, systemType functions
1 parent 936b637 commit fe38886

File tree

1 file changed

+69
-2
lines changed

1 file changed

+69
-2
lines changed

hull-vidispine-addon/templates/_library.tpl

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,18 @@ etcssl:
769769
{{ end }}
770770
{{ end }}
771771
{{ end }}
772+
{{ $extraVolumesSpecified := false }}
772773
{{ if (ne nil (dig $component "extraVolumes" nil $parent.Values.hull.config.specific.components)) }}
773-
{{ range $evKey, $evValue := (index $parent.Values.hull.config.specific.components $component).extraVolumes }}
774+
{{ $extraVolumesSpecified = true }}
775+
{{ end }}
776+
{{ if (ne nil (dig "common" "extraVolumes" nil $parent.Values.hull.config.specific.components)) }}
777+
{{ $extraVolumesSpecified = true }}
778+
{{ end }}
779+
{{ if $extraVolumesSpecified }}
780+
{{ $componentValue := dig $component "extraVolumes" dict $parent.Values.hull.config.specific.components }}
781+
{{ $commonValue := dig "common" "extraVolumes" dict $parent.Values.hull.config.specific.components }}
782+
{{ $extraVolumes := merge $componentValue $commonValue }}
783+
{{ range $evKey, $evValue := $extraVolumes }}
774784
{{ $evKey }}:
775785
{{ $evValue | toYaml | indent 2 }}
776786
{{ end }}
@@ -912,4 +922,61 @@ etcssl:
912922
{{- else -}}
913923
""
914924
{{- end -}}
915-
{{- end -}}
925+
{{- end -}}
926+
927+
928+
929+
{{- define "hull.vidispine.addon.library.systemtype" -}}
930+
{{- $parent := (index . "PARENT_CONTEXT") -}}
931+
{{- $toLower := default true (index . "TO_LOWER") -}}
932+
{{- $systemType := $parent.Values.hull.config.specific.systemType -}}
933+
{{- if $toLower -}}
934+
{{- $systemType | lower -}}
935+
{{- else -}}
936+
{{- $systemType -}}
937+
{{- end -}}
938+
{{- end -}}
939+
940+
941+
942+
{{- define "hull.vidispine.addon.library.systemtype.path" -}}
943+
{{- $parent := (index . "PARENT_CONTEXT") -}}
944+
{{- $file := (index . "FILE") -}}
945+
{{- include "hull.vidispine.addon.library.systemtype" (dict "PARENT_CONTEXT" $parent) -}}/{{- $file -}}
946+
{{- end -}}
947+
948+
949+
950+
{{- define "hull.vidispine.addon.library.systemtype.in" -}}
951+
{{- $parent := (index . "PARENT_CONTEXT") -}}
952+
{{- $check := (index . "CHECK") -}}
953+
{{- $caseSensitive := default false (index . "CASE_SENSITIVE") -}}
954+
{{- $systemType := include "hull.vidispine.addon.library.systemtype" (dict "PARENT_CONTEXT" $parent "TO_LOWER" (not $caseSensitive)) -}}
955+
{{- if (not $caseSensitive) -}}
956+
{{- $check = $check | lower -}}
957+
{{- end -}}
958+
{{- $checks := regexSplit "," $check -1 -}}
959+
{{- $result := false -}}
960+
{{- range $checkValue := $checks -}}
961+
{{- if (eq $systemType ($checkValue | trim)) -}}
962+
{{- $result = true -}}
963+
{{- end -}}
964+
{{- end -}}
965+
{{- $result -}}
966+
{{- end -}}
967+
968+
969+
970+
{{- define "hull.vidispine.addon.library.systemtype.in.conditional.value" -}}
971+
{{- $parent := (index . "PARENT_CONTEXT") -}}
972+
{{- $check := (index . "CHECK") -}}
973+
{{- $caseSensitive := default false (index . "CASE_SENSITIVE") -}}
974+
{{- $valueTrue := (index . "VALUE_TRUE") -}}
975+
{{- $valueFalse := default "" (index . "VALUE_FALSE") -}}
976+
{{- $systemTypeIn := include "hull.vidispine.addon.library.systemtype.in" (dict "PARENT_CONTEXT" $parent "CHECK" $check $parent "TO_LOWER" (not $caseSensitive)) -}}
977+
{{- if $systemTypeIn -}}
978+
{{- $valueTrue -}}
979+
{{- else -}}
980+
{{- $valueFalse }}
981+
{{- end -}}
982+
{{- end -}}

0 commit comments

Comments
 (0)