
[Why] query's value has three types. Can be "xxx", nil, "[xxx]". Only "[xxx]" can do JSON.parse. [Error1] Traceback (most recent call last): 6: from /c/lkp-tests/sbin/monitor:73:in `<main>' 5: from /home/code/lkp-tests/lib/monitor.rb:103:in `run' 4: from /home/code/lkp-tests/lib/monitor.rb:103:in `each' 3: from /home/code/lkp-tests/lib/monitor.rb:104:in `block in run' 2: from /usr/share/ruby/json/common.rb:156:in `parse' 1: from /usr/share/ruby/json/common.rb:156:in `new' /usr/share/ruby/json/common.rb:156:in `initialize': no implicit conversion of nil into String (TypeError) [Error2] Traceback (most recent call last): 6: from /c/lkp-tests/sbin/monitor:73:in `<main>' 5: from /home/code/lkp-tests/lib/monitor.rb:103:in `run' 4: from /home/code/lkp-tests/lib/monitor.rb:103:in `each' 3: from /home/code/lkp-tests/lib/monitor.rb:104:in `block in run' 2: from /usr/share/ruby/json/common.rb:156:in `parse' 1: from /usr/share/ruby/json/common.rb:156:in `new' /usr/share/ruby/json/common.rb:156:in `initialize': no implicit conversion of nil into String (TypeError) Signed-off-by: Wu Zhende <wuzhende666@163.com> --- lib/monitor.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/monitor.rb b/lib/monitor.rb index e0098390..56283e10 100755 --- a/lib/monitor.rb +++ b/lib/monitor.rb @@ -102,6 +102,7 @@ class Monitor @query.each do |k, v| @query[k] = JSON.parse(v) + rescue end query = @query.to_json puts "query=>#{query}" -- 2.23.0