Skip to content

Commit

Permalink
Fix issue #23: drop deprecated sysyinfo call
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerpueyo committed Mar 6, 2017
1 parent 29af4e9 commit 1486642
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions libremap-agent/luasrc/libremap/plugins/system.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ http://www.apache.org/licenses/LICENSE-2.0
]]--

sys = require 'luci.sys'
sys = require 'luci.sys'
util = require 'luci.util'

return {
insert = function(doc, options)
local name, model, memtotal = sys.sysinfo()
local system = {
name = name:match('[^\n]+'),
model = model:match('[^\n]+'),
memtotal = memtotal
}
local sysinfo = util.ubus("system", "info") or { }
local sysboard = util.ubus("system", "board") or { }

local system = { }
system["name"] = sysinfo["hostname"]
system["model"] = sysboard["system"]
system["memtotal"] = sysinfo["memory"]["total"]

doc.attributes = doc.attributes or {}
doc.attributes.system = system
end
Expand Down

0 comments on commit 1486642

Please sign in to comment.