This is an automated email from the ASF dual-hosted git repository.
gerlowskija pushed a commit to branch release-0.9
in repository https://gitbox.apache.org/repos/asf/solr-operator.git
The following commit(s) were added to refs/heads/release-0.9 by this push:
new c5b35fc Fix 'setup-zk' bash syntax error (#769)
c5b35fc is described below
commit c5b35fc4b303bc1d66f00c1939d3d9c0c4b7a623
Author: Jason Gerlowski <[email protected]>
AuthorDate: Mon Mar 17 13:02:45 2025 -0400
Fix 'setup-zk' bash syntax error (#769)
Mismatched brackets were causing the 'grep' portion of the conditional
to report an error when triggered.
---
controllers/solrcloud_controller_basic_auth_test.go | 2 +-
controllers/util/solr_security_util.go | 2 +-
helm/solr-operator/Chart.yaml | 7 +++++++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/controllers/solrcloud_controller_basic_auth_test.go
b/controllers/solrcloud_controller_basic_auth_test.go
index 90eeef2..54b309e 100644
--- a/controllers/solrcloud_controller_basic_auth_test.go
+++ b/controllers/solrcloud_controller_basic_auth_test.go
@@ -353,7 +353,7 @@ func expectPutSecurityJsonInZkCmd(g Gomega,
expInitContainer *corev1.Container)
g.Expect(expInitContainer).To(Not(BeNil()), "Didn't find the setup-zk
InitContainer in the sts!")
expCmd := "solr zk cp zk:/security.json /tmp/current_security.json -z
$ZK_HOST >/dev/null 2>&1; " +
"GET_CURRENT_SECURITY_JSON_EXIT_CODE=$?; if [
${GET_CURRENT_SECURITY_JSON_EXIT_CODE} -eq 0 ]; then " +
- "if [ ! -s /tmp/current_security.json ] || grep -q '^{}$'
/tmp/current_security.json ]; then " +
+ "if [[ ! -s /tmp/current_security.json ]] || grep -q '^{}$'
/tmp/current_security.json ; then " +
"echo $SECURITY_JSON > /tmp/security.json; solr zk cp
/tmp/security.json zk:/security.json -z $ZK_HOST >/dev/null 2>&1; " +
" echo 'Blank security.json found. Put new security.json in
ZK'; fi; elif [ ${GET_CURRENT_SECURITY_JSON_EXIT_CODE} -eq 1 ]; then " +
" echo $SECURITY_JSON > /tmp/security.json; solr zk cp
/tmp/security.json zk:/security.json -z $ZK_HOST >/dev/null 2>&1; " +
diff --git a/controllers/util/solr_security_util.go
b/controllers/util/solr_security_util.go
index c11e98c..eab99d2 100644
--- a/controllers/util/solr_security_util.go
+++ b/controllers/util/solr_security_util.go
@@ -240,7 +240,7 @@ func cmdToPutSecurityJsonInZk() string {
cmd := " solr zk cp zk:/security.json /tmp/current_security.json -z
$ZK_HOST >/dev/null 2>&1; " +
" GET_CURRENT_SECURITY_JSON_EXIT_CODE=$?; " +
"if [ ${GET_CURRENT_SECURITY_JSON_EXIT_CODE} -eq 0 ]; then " +
// JSON already exists
- "if [ ! -s /tmp/current_security.json ] || grep -q '^{}$'
/tmp/current_security.json ]; then " + // File doesn't exist, is empty, or is
just '{}'
+ "if [[ ! -s /tmp/current_security.json ]] || grep -q '^{}$'
/tmp/current_security.json ; then " + // File doesn't exist, is empty, or is
just '{}'
" echo $SECURITY_JSON > /tmp/security.json;" +
" solr zk cp /tmp/security.json zk:/security.json -z $ZK_HOST
>/dev/null 2>&1; " +
" echo 'Blank security.json found. Put new security.json in
ZK'; " +
diff --git a/helm/solr-operator/Chart.yaml b/helm/solr-operator/Chart.yaml
index cb0c878..8cdb604 100644
--- a/helm/solr-operator/Chart.yaml
+++ b/helm/solr-operator/Chart.yaml
@@ -71,6 +71,13 @@ annotations:
url: https://github.com/apache/solr-operator/issues/761
- name: Github PR
url: https://github.com/apache/solr-operator/pull/766
+ - kind: fixed
+ description: "Fix `setup-zk` initContainer no-such-file-or-directory
warning"
+ links:
+ - name: Github Issue
+ url: https://github.com/apache/solr-operator/issues/759
+ - name: Github PR
+ url: https://github.com/apache/solr-operator/pull/769
artifacthub.io/images: |
- name: solr-operator
image: apache/solr-operator:v0.9.1-prerelease