X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=smo-install%2Foran_oom%2Fric-common%2Ftemplates%2F_context_locator.tpl;fp=smo-install%2Foran_oom%2Fric-common%2Ftemplates%2F_context_locator.tpl;h=5155dec752eb8befde385a9e61e7010aa87d0b42;hb=a2c2df5014145ee3126146987d9039e397b12407;hp=0000000000000000000000000000000000000000;hpb=2482dc9de60c39de16d4e85d3fa11d02ec645957;p=it%2Fdep.git diff --git a/smo-install/oran_oom/ric-common/templates/_context_locator.tpl b/smo-install/oran_oom/ric-common/templates/_context_locator.tpl new file mode 100644 index 00000000..5155dec7 --- /dev/null +++ b/smo-install/oran_oom/ric-common/templates/_context_locator.tpl @@ -0,0 +1,37 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + + + + + +{{- define "locate" -}} + {{- $ctx := .ctx }} + {{- $keylist := .keylist }} + {{- $currentkey := first $keylist -}} + {{- $restkeys := rest $keylist -}} + {{- if empty $restkeys -}} + {{- $result := index $ctx $currentkey -}} + {{- if not (empty $result) -}} + {{- $result -}} + {{- end -}} + {{- else -}} + {{- with index $ctx $currentkey }} + {{- $newctx := dict "ctx" . "keylist" $restkeys -}} + {{- include "locate" $newctx -}} + {{- end -}} + {{- end -}} +{{- end -}}