mcarroll1 commented on code in PR #744:
URL: https://github.com/apache/solr-operator/pull/744#discussion_r1939622256


##########
controllers/util/solr_security_util.go:
##########
@@ -240,11 +245,16 @@ func cmdToPutSecurityJsonInZk() string {
        cmd := " solr zk cp zk:/security.json /tmp/current_security.json 
>/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 >/dev/null 
2>&1; " +
                " echo 'Blank security.json found. Put new security.json in 
ZK'; " +
-               "fi; " + // TODO: Consider checking a diff and still applying 
over the top
+               "elif [ \"${SECURITY_JSON_OVERWRITE}\" = true ] && [ \"$(cat 
/tmp/current_security.json)\" != \"$(echo $SECURITY_JSON)\" ]; then " + // We 
want to overwrite the security config if there's a diff

Review Comment:
   Agreed that this bit of bash could probably be optimized. I don't 
immediately see a way of re-arranging the conditions. Maybe I can just create 
function that takes "message" as an input?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to