Skip to content

Commit 372fc9b

Browse files
committed
add reference conditional
1 parent 0bd506f commit 372fc9b

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

hull-vidispine-addon/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,6 +1334,24 @@ Upon providing one or a list of values in the `CHECK` parameters, the return val
13341334

13351335

13361336

1337+
### hull.vidispine.addon.library.refernce.conditional.value
1338+
1339+
Parameters:
1340+
1341+
_PARENT_CONTEXT_: The Helm charts global context
1342+
1343+
_REFERENCE_: A reference in the form of a `_HT*` reference, e.g. `hull.config.specific.my_switch`, which may be used to look up a field in `values.yaml`. The reference must be a boolean field.
1344+
1345+
_VALUE_TRUE_: The value to return in case the value resolved from _REFERENCE_ is `true`
1346+
1347+
_VALUE_FALSE_: The value to return in case the value resolved from _REFERENCE_ is `false`
1348+
1349+
Usage:
1350+
1351+
Checks whether the value resolved from _REFERENCE_ is `true` or `false` and returns provided `VALUE_TRUE` or `VALUE_FALSE` in the respective case.
1352+
1353+
1354+
13371355
### hull.vidispine.addon.library.refernce.in.conditional.value
13381356

13391357
Parameters:

hull-vidispine-addon/templates/_library.tpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,20 @@ etcssl:
982982

983983

984984

985+
{{- define "hull.vidispine.addon.library.reference.conditional.value" -}}
986+
{{- $parent := (index . "PARENT_CONTEXT") -}}
987+
{{- $valueTrue := (index . "VALUE_TRUE") -}}
988+
{{- $valueFalse := default "" (index . "VALUE_FALSE") -}}
989+
{{- $reference := include "hull.vidispine.addon.library.reference" (merge (dict "TO_LOWER" false) .) -}}
990+
{{- if $reference -}}
991+
{{- $valueTrue -}}
992+
{{- else -}}
993+
{{- $valueFalse }}
994+
{{- end -}}
995+
{{- end -}}
996+
997+
998+
985999
{{- define "hull.vidispine.addon.library.reference.in.conditional.value" -}}
9861000
{{- $parent := (index . "PARENT_CONTEXT") -}}
9871001
{{- $check := (index . "CHECK") -}}

0 commit comments

Comments
 (0)