diff options
author | tv <tv@krebsco.de> | 2016-10-23 19:35:00 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2016-10-23 21:50:43 +0200 |
commit | 347520af222481b930cb289584ed92d9ee3be4a2 (patch) | |
tree | 1ebb5458c69345f3526a84aca442bbaf08d424ac | |
parent | 7e008cc650e382f7a2ed5a08e4581189fd17507c (diff) |
-rwxr-xr-x | vcp | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -26,6 +26,29 @@ _netcup_vcp_cmd_kvmInformation() { -q page=vServerKVMGeneral \ -q section=kvmInformation \ -q selectedVServerId="$1" + + text=$(w3m -T text/html -dump -cols 4096 "$_netcup_vcp_content_cache") + vsname=$(echo "$text" | sed -n 's/^vServer-Name\s*\(\S\+\).*/\1/p') \ + state=$(echo "$text" | sed -n 's/^Status\s*\(\S\+\).*/\1/p') \ + boot_device=$(echo "$text" | sed -n 's/^Startlaufwerk\s*\(\S\+\).*/\1/p') \ + attached_iso=$(echo "$text" | sed -n 's/^Momentan eingelegt:\s*\(\S\+\).*/\1/p') \ + net1_mac=$(echo "$text" | grep '^1\s' | awk '{print$2}') \ + net1_ipv4=$(echo "$text" | grep '^1\s' | awk '{print$3}') \ + net1_ipv6=$(echo "$text" | grep '^1\s' | awk '{print$4}') \ + ftp_host=$(echo "$text" | sed -n 's/^Hostname:\s*\(\S\+\).*/\1/p') \ + ftp_user=$(echo "$text" | sed -n 's/^Benutzername:\s*\(\S\+\).*/\1/p') \ + ftp_pass=$(echo "$text" | sed -n 's/^Passwort:\s*\(\S\+\).*/\1/p') \ + jq -n '{ + vsname: env.vsname, + state: { gestartet: "online", gestoppt: "offline" }[env.state], + boot_device: env.boot_device, + attached_iso: + (if env.attached_iso == "n/a" then null else env.attached_iso end), + network: [ + { mac: env.net1_mac, ipv4: env.net1_ipv4, ipv6: env.net1_ipv6 } + ], + ftp: { host: env.ftp_host, pass: env.ftp_pass, user: env.ftp_user } + }' } # attachCdrom : VServerID, ImageName -> TODO |