You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/05/14 04:33:57 UTC

[GitHub] [apisix] kwanhur opened a new pull request, #7048: feat(ops): use lua libs to backup config file insteadof shell command

kwanhur opened a new pull request, #7048:
URL: https://github.com/apache/apisix/pull/7048

   
   ### Description
   To avoid tool loss in some OS, use Lua library related filesystem, like `exist` `rename` and `link` etc.
   <!-- Please include a summary of the change and which issue is fixed. -->
   
   <!-- Please also include relevant motivation and context. -->
   * backup and recover files with os.rename insteadof mv
   * remove files with os.remove insteadof rm
   * link file with lfs.link insteadof ln
   * exist file with penlight.exist insteadof io.open
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [ ] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
   
   <!--
   
   Note
   
   1. Mark the PR as draft until it's ready to be reviewed.
   2. Always add/update tests for any changes unless you have a good reason.
   3. Always update the documentation to reflect the changes made in the PR.
   4. Make a new commit to resolve conversations instead of `push -f`.
   5. To resolve merge conflicts, merge master instead of rebasing.
   6. Use "request review" to notify the reviewer after making changes.
   7. Only a reviewer can mark a conversation as resolved.
   
   -->
   


-- 
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


[GitHub] [apisix] spacewander commented on pull request #7048: feat(ops): use lua libs to backup config file insteadof shell command

Posted by GitBox <gi...@apache.org>.
spacewander commented on PR #7048:
URL: https://github.com/apache/apisix/pull/7048#issuecomment-1127293506

   Let's merge master to make CI pass.


-- 
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


[GitHub] [apisix] spacewander commented on pull request #7048: feat(ops): use lua libs to backup config file insteadof shell command

Posted by GitBox <gi...@apache.org>.
spacewander commented on PR #7048:
URL: https://github.com/apache/apisix/pull/7048#issuecomment-1132624941

   @kwanhur 
   Let's resolve the conflicts. Thanks!


-- 
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


[GitHub] [apisix] kwanhur commented on a diff in pull request #7048: feat(ops): use lua libs to backup config file insteadof shell command

Posted by GitBox <gi...@apache.org>.
kwanhur commented on code in PR #7048:
URL: https://github.com/apache/apisix/pull/7048#discussion_r873183837


##########
apisix/cli/ops.lua:
##########
@@ -797,9 +802,10 @@ end
 local function test(env, backup_ngx_conf)
     -- backup nginx.conf
     local ngx_conf_path = env.apisix_home .. "/conf/nginx.conf"
-    local ngx_conf_exist = util.is_file_exist(ngx_conf_path)

Review Comment:
   Remove it after `cert_path` checking with `pl_path.exist`. Had done.



-- 
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


[GitHub] [apisix] kwanhur commented on pull request #7048: feat(ops): use lua libs to backup config file insteadof shell command

Posted by GitBox <gi...@apache.org>.
kwanhur commented on PR #7048:
URL: https://github.com/apache/apisix/pull/7048#issuecomment-1127558677

   Done.


-- 
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


[GitHub] [apisix] spacewander commented on a diff in pull request #7048: feat(ops): use lua libs to backup config file insteadof shell command

Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #7048:
URL: https://github.com/apache/apisix/pull/7048#discussion_r873159237


##########
apisix/cli/ops.lua:
##########
@@ -797,9 +802,10 @@ end
 local function test(env, backup_ngx_conf)
     -- backup nginx.conf
     local ngx_conf_path = env.apisix_home .. "/conf/nginx.conf"
-    local ngx_conf_exist = util.is_file_exist(ngx_conf_path)

Review Comment:
   Look like we can remove `is_file_exist` in `util` now?



-- 
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


[GitHub] [apisix] spacewander merged pull request #7048: feat(ops): use lua libs to backup config file insteadof shell command

Posted by GitBox <gi...@apache.org>.
spacewander merged PR #7048:
URL: https://github.com/apache/apisix/pull/7048


-- 
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


[GitHub] [apisix] kwanhur commented on pull request #7048: feat(ops): use lua libs to backup config file insteadof shell command

Posted by GitBox <gi...@apache.org>.
kwanhur commented on PR #7048:
URL: https://github.com/apache/apisix/pull/7048#issuecomment-1132938042

   Fixed.


-- 
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


[GitHub] [apisix] tokers commented on a diff in pull request #7048: feat(ops): use lua libs to backup config file insteadof shell command

Posted by GitBox <gi...@apache.org>.
tokers commented on code in PR #7048:
URL: https://github.com/apache/apisix/pull/7048#discussion_r875387907


##########
apisix/cli/ops.lua:
##########
@@ -467,9 +469,8 @@ Please modify "admin_key" in conf/config.yaml .
         -- Therefore we need to check the absolute version instead
         cert_path = pl_path.abspath(cert_path)
 
-        local ok, err = util.is_file_exist(cert_path)
-        if not ok then
-            util.die(err, "\n")
+        if not pl_path.exists(cert_path) then
+            util.die("certificate path", cert_path, "isn't exist\n")

Review Comment:
   ```suggestion
               util.die("certificate path", cert_path, "doesn't exist\n")
   ```



-- 
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