diff options
author | Florian Eckert <fe@dev.tdt.de> | 2020-07-28 16:05:02 +0200 |
---|---|---|
committer | Florian Eckert <fe@dev.tdt.de> | 2020-07-28 16:05:02 +0200 |
commit | c19a7d18e5b3c2d17480502086af6d8a8287d39a (patch) | |
tree | 57f6dab760d79d7b71f9465ec72ff28838de1571 /applications/luci-app-dockerman | |
parent | dff11ad2404d77be1da786883fa7155b83a67be0 (diff) |
luci-app-dockerman: cbi/container fix indent
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'applications/luci-app-dockerman')
-rw-r--r-- | applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua b/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua index dfcb42ddb..6628ed055 100644 --- a/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua +++ b/applications/luci-app-dockerman/luasrc/model/cbi/dockerman/container.lua @@ -700,28 +700,31 @@ elseif action == "console" then local cmd_docker = luci.util.exec("which docker"):match("^.+docker") or nil local cmd_ttyd = luci.util.exec("which ttyd"):match("^.+ttyd") or nil - if not cmd_docker or not cmd_ttyd or cmd_docker:match("^%s+$") or cmd_ttyd:match("^%s+$") then return end - local kill_ttyd = 'netstat -lnpt | grep ":7682[ \t].*ttyd$" | awk \'{print $NF}\' | awk -F\'/\' \'{print "kill -9 " $1}\' | sh > /dev/null' - luci.util.exec(kill_ttyd) - local hosts - local uci = (require "luci.model.uci").cursor() - local remote = uci:get_bool("dockerd", "globals", "remote_endpoint") - local host = nil - local port = nil - local socket = nil - - if remote then - host = uci:get("dockerd", "globals", "remote_host") or nil - port = uci:get("dockerd", "globals", "remote_port") or nil - else - socket = uci:get("dockerd", "globals", "socket_path") or nil - end + if not cmd_docker or not cmd_ttyd or cmd_docker:match("^%s+$") or cmd_ttyd:match("^%s+$")then + return + end - if remote and host and port then - hosts = host .. ':'.. port - elseif socket_path then - hosts = "unix://" .. socket_path - else + local kill_ttyd = 'netstat -lnpt | grep ":7682[ \t].*ttyd$" | awk \'{print $NF}\' | awk -F\'/\' \'{print "kill -9 " $1}\' | sh > /dev/null' + luci.util.exec(kill_ttyd) + local hosts + local uci = (require "luci.model.uci").cursor() + local remote = uci:get_bool("dockerd", "globals", "remote_endpoint") + local host = nil + local port = nil + local socket = nil + + if remote then + host = uci:get("dockerd", "globals", "remote_host") or nil + port = uci:get("dockerd", "globals", "remote_port") or nil + else + socket = uci:get("dockerd", "globals", "socket_path") or nil + end + + if remote and host and port then + hosts = host .. ':'.. port + elseif socket_path then + hosts = "unix://" .. socket_path + else return end |