CNSRE/ABTestingGateway

新增分流方式出错module 'abtesting.diversion.arg_station' not found

hypier opened this issue · 1 comments

[root@localhost logs]# cat admin.log
2017/12/07 16:53:12 [error] 8391#0: *1 [lua] log.lua:28: errlog(): ab_div host [ab_admin] code : 40201, desc : lua runtime error ../lib/abtesting/adapter/policy.lua:95: module 'abtesting.diversion.arg_station' not found:
no field package.preload['abtesting.diversion.arg_station']
no file '../abtesting/diversion/arg_station.lua'
no file '../lib/abtesting/diversion/arg_station.lua'
no file '../lib/lua-resty-core/lib/abtesting/diversion/arg_station.lua'
no file '/usr/local/openresty/lualib/abtesting/diversion/arg_station.lua'
no file '/usr/local/openresty/lualib/abtesting/diversion/arg_station/init.lua'
no file './abtesting/diversion/arg_station.lua'
no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta1/abtesting/diversion/arg_station.lua'
no file '/usr/local/share/lua/5.1/abtesting/diversion/arg_station.lua'
no file '/usr/local/share/lua/5.1/abtesting/diversion/arg_station/init.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/abtesting/diversion/arg_station.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/abtesting/diversion/arg_station/init.lua'
no file '/usr/local/openresty/lualib/abtesting/diversion/arg_station.so'
no file './abtesting/diversion/arg_station.so'
no file '/usr/local/lib/lua/5.1/abtesting/diversion/arg_station.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/abtesting/diversion/arg_station.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/local/openresty/lualib/abtesting.so'
no file './abtesting.so'
no file '/usr/local/lib/lua/5.1/abtesting.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/abtesting.so'
no file '/usr/local/lib/lua/5.1/loadall.so', errstack : stack traceback:
../lib/abtesting/error/handler.lua:17: in function <../lib/abtesting/error/handler.lua:7>
[C]: in function 'require'
../lib/abtesting/adapter/policy.lua:95: in function 'check'
../lib/abtesting/adapter/policygroup.lua:117: in function <../lib/abtesting/adapter/policygroup.lua:111>
[C]: in function 'xpcall'
../admin/policygroup.lua:160: in function 'checkPolicy'
../admin/policygroup.lua:192: in function 'do_action'
/usr/local/dygateway/utils/../admin/ab_action.lua:82: in function </usr/local/dygateway/utils/../admin/ab_action.lua:1>, client: 127.0.0.1, server: localhost, request: "POST /ab_admin?action=policygroup_set HTTP/1.1", host: "127.0.0.1:8080"

按照arg_city.lua新增了一个分流方式,
1.在lib/abtesting/diversion/下新增文件arg_station.lua
2.在lib/abtesting/userinfo/下新增文件stationParser.lua
3.在lib/abtesting/utils/init.lua文件中新增 ["arg_station"] = 'stationParser' 语句

然后使用abtesting.sh方式重启,最后增加相关策略报上述错误

curl 127.0.0.1:8080/ab_admin?action=policygroup_set -d '{"1":{"divtype":"arg_station","divdata":[{"station":"HDQA00","upstream":"beta1"},{"station":"CQ11","upstream":"beta2"},{"station":"CQ12","upstream":"beta1"},{"station":"CQ13","upstream":"beta3"}]}}'

是还有哪个地方没有加吗,还是什么问题,多谢

问题解决了,权限问题

[root@localhost diversion]# ll
total 28
-rw-r--r--. 1 root root 2007 Mar 6 2017 arg_city.lua
-rw-------. 1 root root 2040 Dec 7 18:49 arg_station.lua
-rw-r--r--. 1 root root 4018 Mar 6 2017 iprange.lua
-rw-r--r--. 1 root root 2761 Mar 6 2017 uidappoint.lua
-rw-r--r--. 1 root root 3931 Mar 6 2017 uidrange.lua
-rw-r--r--. 1 root root 2325 Mar 6 2017 uidsuffix.lua
-rw-r--r--. 1 root root 2243 Mar 6 2017 url.lua
[root@localhost diversion]# pwd
/usr/local/dygateway/lib/abtesting/diversion
[root@localhost diversion]#
[root@localhost diversion]# ll
total 28
-rw-r--r--. 1 root root 2007 Mar 6 2017 arg_city.lua
-rw-r--r--. 1 root root 2040 Dec 7 18:49 arg_station.lua
-rw-r--r--. 1 root root 4018 Mar 6 2017 iprange.lua
-rw-r--r--. 1 root root 2761 Mar 6 2017 uidappoint.lua
-rw-r--r--. 1 root root 3931 Mar 6 2017 uidrange.lua
-rw-r--r--. 1 root root 2325 Mar 6 2017 uidsuffix.lua
-rw-r--r--. 1 root root 2243 Mar 6 2017 url.lua
[root@localhost diversion]# curl 127.0.0.1:8080/ab_admin?action=policygroup_set -d '{"1":{"divtype":"arg_station","divdata":[{"station":"HDQA00","upstream":"beta1"},{"station":"CQ11","upstream":"beta2"},{"station":"CQ12","upstream":"beta1"},{"station":"CQ13","upstream":"beta3"}]}}'
{"desc":"success ","code":200,"data":{"groupid":2,"group":[2]}}