X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=it%2Fdep.git;a=blobdiff_plain;f=smo-install%2Foran_oom%2Fdmaapmediatorservice%2Fresources%2Fdmaap-topic-init.sh;fp=smo-install%2Foran_oom%2Fnonrtric-common%2Ftemplates%2F_helmmanager.tpl;h=be8c6c8f029df3c1c3b271855a3ad92f2ad34a2e;hp=736bff353f0107dc4f69d718726a224923a9a8f4;hb=918108f729c368db61fe904024129f21269e19b7;hpb=c9ace66e2b4635918c4c4c473dfc7bcbeb41b7ae diff --git a/smo-install/oran_oom/nonrtric-common/templates/_helmmanager.tpl b/smo-install/oran_oom/dmaapmediatorservice/resources/dmaap-topic-init.sh similarity index 73% rename from smo-install/oran_oom/nonrtric-common/templates/_helmmanager.tpl rename to smo-install/oran_oom/dmaapmediatorservice/resources/dmaap-topic-init.sh index 736bff35..be8c6c8f 100644 --- a/smo-install/oran_oom/nonrtric-common/templates/_helmmanager.tpl +++ b/smo-install/oran_oom/dmaapmediatorservice/resources/dmaap-topic-init.sh @@ -1,5 +1,6 @@ +#!/bin/sh ################################################################################ -# Copyright (c) 2021 Nordix Foundation. # +# Copyright (c) 2024 NYCU WINLab. # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -14,11 +15,13 @@ # limitations under the License. # ################################################################################ -{{- define "common.name.helmmanager" -}} - {{- printf "helmmanager" -}} -{{- end -}} +topics='{{ .Values.dmaapTopicInit.topics | toRawJson }}' -{{- define "common.container.helmmanager" -}} - {{- $name := ( include "common.name.helmmanager" . ) -}} - {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} +echo $topics | jq -c '.[]' | while read -r obj; do + curl -X POST -H "Content-Type: application/json" -d "$obj" {{ .Values.dmaapTopicInit.dmaapMrAddr }}/topics/create + response=$? + if [ $response -ne 0 ]; then + echo "Failed to create topic $obj" + exit 1 + fi +done