Skip to content

Commit c5b35fc

Browse files
committed
Fix 'setup-zk' bash syntax error (#769)
Mismatched brackets were causing the 'grep' portion of the conditional to report an error when triggered.
1 parent 21ec059 commit c5b35fc

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Diff for: controllers/solrcloud_controller_basic_auth_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ func expectPutSecurityJsonInZkCmd(g Gomega, expInitContainer *corev1.Container)
353353
g.Expect(expInitContainer).To(Not(BeNil()), "Didn't find the setup-zk InitContainer in the sts!")
354354
expCmd := "solr zk cp zk:/security.json /tmp/current_security.json -z $ZK_HOST >/dev/null 2>&1; " +
355355
"GET_CURRENT_SECURITY_JSON_EXIT_CODE=$?; if [ ${GET_CURRENT_SECURITY_JSON_EXIT_CODE} -eq 0 ]; then " +
356-
"if [ ! -s /tmp/current_security.json ] || grep -q '^{}$' /tmp/current_security.json ]; then " +
356+
"if [[ ! -s /tmp/current_security.json ]] || grep -q '^{}$' /tmp/current_security.json ; then " +
357357
"echo $SECURITY_JSON > /tmp/security.json; solr zk cp /tmp/security.json zk:/security.json -z $ZK_HOST >/dev/null 2>&1; " +
358358
" echo 'Blank security.json found. Put new security.json in ZK'; fi; elif [ ${GET_CURRENT_SECURITY_JSON_EXIT_CODE} -eq 1 ]; then " +
359359
" echo $SECURITY_JSON > /tmp/security.json; solr zk cp /tmp/security.json zk:/security.json -z $ZK_HOST >/dev/null 2>&1; " +

Diff for: controllers/util/solr_security_util.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func cmdToPutSecurityJsonInZk() string {
240240
cmd := " solr zk cp zk:/security.json /tmp/current_security.json -z $ZK_HOST >/dev/null 2>&1; " +
241241
" GET_CURRENT_SECURITY_JSON_EXIT_CODE=$?; " +
242242
"if [ ${GET_CURRENT_SECURITY_JSON_EXIT_CODE} -eq 0 ]; then " + // JSON already exists
243-
"if [ ! -s /tmp/current_security.json ] || grep -q '^{}$' /tmp/current_security.json ]; then " + // File doesn't exist, is empty, or is just '{}'
243+
"if [[ ! -s /tmp/current_security.json ]] || grep -q '^{}$' /tmp/current_security.json ; then " + // File doesn't exist, is empty, or is just '{}'
244244
" echo $SECURITY_JSON > /tmp/security.json;" +
245245
" solr zk cp /tmp/security.json zk:/security.json -z $ZK_HOST >/dev/null 2>&1; " +
246246
" echo 'Blank security.json found. Put new security.json in ZK'; " +

Diff for: helm/solr-operator/Chart.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ annotations:
7171
url: https://github.com/apache/solr-operator/issues/761
7272
- name: Github PR
7373
url: https://github.com/apache/solr-operator/pull/766
74+
- kind: fixed
75+
description: "Fix `setup-zk` initContainer no-such-file-or-directory warning"
76+
links:
77+
- name: Github Issue
78+
url: https://github.com/apache/solr-operator/issues/759
79+
- name: Github PR
80+
url: https://github.com/apache/solr-operator/pull/769
7481
artifacthub.io/images: |
7582
- name: solr-operator
7683
image: apache/solr-operator:v0.9.1-prerelease

0 commit comments

Comments
 (0)