summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-lxc/luasrc/model/cbi
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2018-05-26 19:32:39 +0200
committerDirk Brenken <dev@brenken.org>2018-05-27 20:46:13 +0200
commitd9b6c5dd781fec6603e7941b72774b9af140e858 (patch)
tree4aa99a1d39c05c418e5c5609f7b0c13540d13f8d /applications/luci-app-lxc/luasrc/model/cbi
parentfa4dc6be91ad86dbaa0959b40bdb14f50ad21a67 (diff)
luci-app-lxc: fix "plain-vanilla" integration, part 2
I've tried to get the lxc app in a more usable state. Tested with mips and amd64 targets. * check /etc/config/lxc in controller, not in cbi * more controller cleanups * remove unused 'fork_exec' function * check path before container creation * check space requirements before container creation * support new uci options 'min_space' and 'min_temp', default for both is 100000 KB * both options are configurable via LuCI CBI template * write messages to log in case of an error * validate the container name during creation, automatically remove invalid chars * inform the user that only a stopped container can be destroyed * add experimental ssl support (untested, disabled by default) Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-lxc/luasrc/model/cbi')
-rw-r--r--applications/luci-app-lxc/luasrc/model/cbi/lxc.lua39
1 files changed, 27 insertions, 12 deletions
diff --git a/applications/luci-app-lxc/luasrc/model/cbi/lxc.lua b/applications/luci-app-lxc/luasrc/model/cbi/lxc.lua
index 7040f0ecff..8a8fc2be0d 100644
--- a/applications/luci-app-lxc/luasrc/model/cbi/lxc.lua
+++ b/applications/luci-app-lxc/luasrc/model/cbi/lxc.lua
@@ -14,20 +14,35 @@ Author: Petar Koretic <petar.koretic@sartura.hr>
]]--
-local fs = require "nixio.fs"
-
m = Map("lxc", translate("LXC Containers"),
translate("<b>Please note:</b> For LXC Containers you need a custom OpenWrt image.<br />")
.. translate("The image should include at least support for 'kernel cgroups', 'kernel namespaces' and 'miscellaneous LXC related options'."))
-
-if fs.access("/etc/config/lxc") then
- m:section(SimpleSection).template = "lxc"
-
- s = m:section(TypedSection, "lxc", translate("Options"))
- s.anonymous = true
- s.addremove = false
-
- s:option(Value, "url", translate("Containers URL"))
-end
+m:section(SimpleSection).template = "lxc"
+
+s = m:section(TypedSection, "lxc", translate("Options"))
+s.anonymous = true
+
+o1 = s:option(Value, "url", translate("Containers URL"))
+o1:value("images.linuxcontainers.org")
+o1:value("repo.turris.cz/lxc", "repo.turris.cz/lxc (SSL req.)")
+o1.default = "images.linuxcontainers.org"
+o1.rmempty = false
+
+o2 = s:option(Flag, "ssl_enabled", translate("Enable SSL"),
+ translate("Enable optional SSL encryption support. This requires additional packages like 'wget', 'ca-certificates', 'gnupg' and 'gnupg-utils'."))
+o2.default = o2.disabled
+o2.rmempty = false
+
+o3 = s:option(Value, "min_space", translate("Free Space Threshold"),
+ translate("Minimum required free space for LXC Container creation in KB"))
+o3.default = "100000"
+o3.datatype = "min(50000)"
+o3.rmempty = false
+
+o4 = s:option(Value, "min_temp", translate("Free Temp Threshold"),
+ translate("Minimum required free temp space for LXC Container creation in KB"))
+o4.default = "100000"
+o4.datatype = "min(50000)"
+o4.rmempty = false
return m