@@ -148,7 +148,7 @@ function get_custom_resource_domain() {
148148 -v \
149149 --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt \
150150 -H " Authorization: Bearer $( cat /var/run/secrets/kubernetes.io/serviceaccount/token) " \
151- $kubernetes_master /apis/weblogic.oracle/$domain_api_version /namespaces/$wls_domain_namespace /domains/$domain_uid )
151+ $kubernetes_master /apis/weblogic.oracle/$domain_api_version /namespaces/$wls_domain_namespace /domains/$wls_domain_uid )
152152 if [ $? -ne 0 ]; then
153153 trace " Failed to retrieve WebLogic Domain Custom Resource Definition"
154154 exit 1
@@ -164,7 +164,7 @@ function is_defined_in_clusters() {
164164 local in_cluster_startup=" False"
165165
166166 if jq_available; then
167- local inClusterStartupCmd=" (.items[]. spec.clusters[] | select (.clusterName == \" ${wls_cluster_name} \" ))"
167+ local inClusterStartupCmd=" (.spec.clusters[] | select (.clusterName == \" ${wls_cluster_name} \" ))"
168168 local clusterDefinedInCRD=$( echo " ${DOMAIN} " | jq " ${inClusterStartupCmd} " 2>> ${log_file_name} )
169169 if [ " ${clusterDefinedInCRD} " != " " ]; then
170170 in_cluster_startup=" True"
@@ -173,13 +173,11 @@ function is_defined_in_clusters() {
173173cat > cmds-$$ .py << INPUT
174174import sys, json
175175outer_loop_must_break = False
176- for i in json.load(sys.stdin)["items"]:
177- j = i["spec"]["clusters"]
178- for index, cs in enumerate(j):
179- if j[index]["clusterName"] == "$wls_cluster_name ":
180- outer_loop_must_break = True
181- print (True)
182- break
176+ for j in json.load(sys.stdin)["spec"]["clusters"]:
177+ if j["clusterName"] == "$wls_cluster_name ":
178+ outer_loop_must_break = True
179+ print (True)
180+ break
183181if outer_loop_must_break == False:
184182 print (False)
185183INPUT
@@ -195,16 +193,14 @@ function get_num_ms_in_cluster() {
195193 local DOMAIN=" $1 "
196194 local num_ms
197195 if jq_available; then
198- local numManagedServersCmd=" (.items[]. spec.clusters[] | select (.clusterName == \" ${wls_cluster_name} \" ) | .replicas)"
196+ local numManagedServersCmd=" (.spec.clusters[] | select (.clusterName == \" ${wls_cluster_name} \" ) | .replicas)"
199197 num_ms=$( echo " ${DOMAIN} " | jq " ${numManagedServersCmd} " 2>> ${log_file_name} )
200198 else
201199cat > cmds-$$ .py << INPUT
202200import sys, json
203- for i in json.load(sys.stdin)["items"]:
204- j = i["spec"]["clusters"]
205- for index, cs in enumerate(j):
206- if j[index]["clusterName"] == "$wls_cluster_name ":
207- print (j[index]["replicas"])
201+ for j in json.load(sys.stdin)["spec"]["clusters"]:
202+ if j["clusterName"] == "$wls_cluster_name ":
203+ print (j["replicas"])
208204INPUT
209205 num_ms=` echo ${DOMAIN} | python cmds-$$ .py 2>> ${log_file_name} `
210206 fi
@@ -223,12 +219,11 @@ function get_num_ms_domain_scope() {
223219 local DOMAIN=" $1 "
224220 local num_ms
225221 if jq_available; then
226- num_ms=$( echo " ${DOMAIN} " | jq -r ' .items[]. spec.replicas' 2>> ${log_file_name} )
222+ num_ms=$( echo " ${DOMAIN} " | jq -r ' .spec.replicas' 2>> ${log_file_name} )
227223 else
228224cat > cmds-$$ .py << INPUT
229225import sys, json
230- for i in json.load(sys.stdin)["items"]:
231- print (i["spec"]["replicas"])
226+ print (json.load(sys.stdin)["spec"]["replicas"])
232227INPUT
233228 num_ms=` echo ${DOMAIN} | python cmds-$$ .py 2>> ${log_file_name} `
234229 fi
@@ -254,17 +249,15 @@ function get_min_replicas {
254249
255250 eval $__result =0
256251 if jq_available; then
257- minReplicaCmd=" (.items[]. status.clusters[] | select (.clusterName == \" ${clusterName} \" )) \
252+ minReplicaCmd=" (.status.clusters[] | select (.clusterName == \" ${clusterName} \" )) \
258253 | .minimumReplicas"
259254 minReplicas=$( echo ${domainJson} | jq " ${minReplicaCmd} " 2>> ${log_file_name} )
260255 else
261256cat > cmds-$$ .py << INPUT
262257import sys, json
263- for i in json.load(sys.stdin)["items"]:
264- j = i["status"]["clusters"]
265- for index, cs in enumerate(j):
266- if j[index]["clusterName"] == "$clusterName ":
267- print (j[index]["minimumReplicas"])
258+ for j in json.load(sys.stdin)["status"]["clusters"]:
259+ if j["clusterName"] == "$clusterName ":
260+ print (j["minimumReplicas"])
268261INPUT
269262 minReplicas=` echo ${DOMAIN} | python cmds-$$ .py 2>> ${log_file_name} `
270263 fi
0 commit comments