luci-app-lxc: use ubus binding for lxc-create
authorPetar Koretic <petar.koretic@sartura.hr>
Mon, 17 Nov 2014 15:31:54 +0000 (16:31 +0100)
committerLuka Perkov <luka@openwrt.org>
Tue, 18 Nov 2014 12:46:30 +0000 (13:46 +0100)
Signed-off-by: Petar Koretic <petar.koretic@sartura.hr>
utils/luci-app-lxc/files/controller/lxc.lua

index ce7b53e6eadd4c30efb6ee3aeed82b1e9bcddb57..f3f5d07ba78da9d20792add2f79b225608df5854 100644 (file)
@@ -80,9 +80,9 @@ function lxc_create(lxc_name, lxc_template)
 
        local target = _G.DISTRIB_TARGET:match('([^/]+)')
 
-       local res = os.execute("lxc-create -t download -n " .. lxc_name .. " -- --server=" .. url .. " --no-validate --dist " .. lxc_template .. " --release bb --arch " .. target)
+       local data = conn:call("lxc", "create", { name = lxc_name, template = "download", args = { "--server", url,  "--no-validate", "--dist", lxc_template, "--release", "bb", "--arch", target } } )
 
-       luci.http.write(tostring(res))
+       luci.http.write(data)
 end
 
 function lxc_action(lxc_action, lxc_name)