Skip to content

Commit 8de3ffd

Browse files
Miss-youSaberMaster
authored andcommitted
bugfix(CLI): generate the 'worker_cpu_affinity' config for Linux OS (apache#1658)
Fix apache#1657
1 parent 6b40832 commit 8de3ffd

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.travis/apisix_cli_test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ done
7373
sed -i '/dns_resolver:/,+4s/^#//' conf/config.yaml
7474
echo "passed: system nameserver imported"
7575

76+
# check whether the 'worker_cpu_affinity' is in nginx.conf .
77+
78+
make init
79+
80+
grep -E "worker_cpu_affinity" conf/nginx.conf > /dev/null
81+
if [ ! $? -eq 0 ]; then
82+
echo "failed: nginx.conf file is missing worker_cpu_affinity configuration"
83+
exit 1
84+
fi
85+
86+
echo "passed: nginx.conf file contains worker_cpu_affinity configuration"
87+
7688
# check admin https enabled
7789

7890
sed -i 's/\# port_admin: 9180/port_admin: 9180/' conf/config.yaml

bin/apisix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ local function trim(s)
2121
return (s:gsub("^%s*(.-)%s*$", "%1"))
2222
end
2323

24+
-- Note: The `excute_cmd` return value will have a line break at the end,
25+
-- it is recommended to use the `trim` function to handle the return value.
2426
local function excute_cmd(cmd)
2527
local t, err = io.popen(cmd)
2628
if not t then
@@ -676,7 +678,7 @@ local function init()
676678
local sys_conf = {
677679
lua_path = pkg_path_org,
678680
lua_cpath = pkg_cpath_org,
679-
os_name = excute_cmd("uname"),
681+
os_name = trim(excute_cmd("uname")),
680682
apisix_lua_home = apisix_home,
681683
with_module_status = with_module_status,
682684
error_log = {level = "warn"},

0 commit comments

Comments
 (0)