You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org> on 2023/05/23 07:54:27 UTC

[GitHub] [apisix] monkeyDluffy6017 commented on a diff in pull request #9521: fix: start error bug

monkeyDluffy6017 commented on code in PR #9521:
URL: https://github.com/apache/apisix/pull/9521#discussion_r1201718431


##########
apisix/cli/ops.lua:
##########
@@ -807,17 +807,19 @@ local function start(env, ...)
         local local_conf_path = profile:yaml_path("config")
         local local_conf_path_bak = local_conf_path .. ".bak"
 
-        local ok, err = os_rename(local_conf_path, local_conf_path_bak)
-        if not ok then
-            util.die("failed to backup config, error: ", err)
-        end
-        local ok, err1 = lfs.link(customized_yaml, local_conf_path)
-        if not ok then
-            ok, err = os_rename(local_conf_path_bak,  local_conf_path)
+        if not pl_path.exists(local_conf_path_bak) then
+            local ok, err = os_rename(local_conf_path, local_conf_path_bak)
             if not ok then
-                util.die("failed to recover original config file, error: ", err)
+                util.die("failed to backup config, error: ", err)
+            end
+            local ok, err1 = lfs.link(customized_yaml, local_conf_path)
+            if not ok then
+                ok, err = os_rename(local_conf_path_bak,  local_conf_path)
+                if not ok then
+                    util.die("failed to recover original config file, error: ", err)
+                end
+                util.die("failed to link customized config, error: ", err1)
             end
-            util.die("failed to link customized config, error: ", err1)
         end

Review Comment:
   Is this an appropriate change? the customized_yaml won't work if there is a `local_conf_path_bak` file



-- 
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: notifications-unsubscribe@apisix.apache.org

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