$def with (machine, root_ssh, admin_ssh) $var breadcrumbs = ("machines", "Machines") $var title: $machine["name"]
$machine["ip_address"]
$ d = machine["details"] $#$d
$code: def get_output(cmd): output = root_ssh(cmd).stdout if "\n" not in output: output += "\n" return output.rpartition("\n")[0] def get_admin_output(cmd): output = admin_ssh(cmd).stdout if "\n" not in output: output += "\n" return output.rpartition("\n")[0] $def render(cmd):$get_output(cmd)$def admin_render(cmd):
$get_admin_output(cmd)
\ $for line in get_output("ls -lh /home/admin/app/run").splitlines(): $ parts = line.split()[-5:] $if len(parts) < 5: $continue $ size, month, day, yeartime, path = parts $month $day $yeartime \ $if size: \ $path\ $if size: \ $size
$status["ActiveState"]
Last updated: $d.get("updated")
$# $# $# $if d.get("supervisor"): $#Supervisor: $d["supervisor"]
$# $else: $# $# $# $if d.get("nginx"): $#Nginx: $d["nginx"]
$# $else: $# $# $# $if d.get("tor"): $#Tor: $d["tor"]
$# $else: $# $# $# $if d.get("python"): $#Python: $d["python"]
$# $else: $# $# $#Canopy: $d["canopy"]
$#